mymath

package
v0.0.0-...-8b651fe Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 13, 2017 License: MIT Imports: 31 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BitcoinAlphabet = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"

alphabet used by Bitcoins

View Source
var BitcoinRevAlp = map[string]int{
	"1": 0, "2": 1, "3": 2, "4": 3, "5": 4, "6": 5, "7": 6, "8": 7, "9": 8, "A": 9,
	"B": 10, "C": 11, "D": 12, "E": 13, "F": 14, "G": 15, "H": 16, "J": 17, "K": 18, "L": 19,
	"M": 20, "N": 21, "P": 22, "Q": 23, "R": 24, "S": 25, "T": 26, "U": 27, "V": 28, "W": 29,
	"X": 30, "Y": 31, "Z": 32, "a": 33, "b": 34, "c": 35, "d": 36, "e": 37, "f": 38, "g": 39,
	"h": 40, "i": 41, "j": 42, "k": 43, "m": 44, "n": 45, "o": 46, "p": 47, "q": 48, "r": 49,
	"s": 50, "t": 51, "u": 52, "v": 53, "w": 54, "x": 55, "y": 56, "z": 57,
}

reverse alphabet used for quckly converting base58 strings into numbers

View Source
var RippleAlphabet = "rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz"
View Source
var RippleRevAlp = map[string]int{
	"r": 0, "p": 1, "s": 2, "h": 3, "n": 4, "a": 5, "f": 6, "3": 7, "9": 8, "w": 9,
	"B": 10, "U": 11, "D": 12, "N": 13, "E": 14, "G": 15, "H": 16, "J": 17, "K": 18, "L": 19,
	"M": 20, "4": 21, "P": 22, "Q": 23, "R": 24, "S": 25, "T": 26, "7": 27, "V": 28, "W": 29,
	"X": 30, "Y": 31, "Z": 32, "2": 33, "b": 34, "c": 35, "d": 36, "e": 37, "C": 38, "g": 39,
	"6": 40, "5": 41, "j": 42, "k": 43, "m": 44, "8": 45, "o": 46, "F": 47, "q": 48, "i": 49,
	"1": 50, "t": 51, "u": 52, "v": 53, "A": 54, "x": 55, "y": 56, "z": 57,
}

Functions

func AESDecrypt

func AESDecrypt(key string, ciphertext []byte) (string, error)

func AESDecryptBytes

func AESDecryptBytes(key []byte, ciphertext []byte) ([]byte, error)

func AESDecryptBytesCBC

func AESDecryptBytesCBC(key []byte, ciphertext []byte) ([]byte, error)

func AESDecryptCBC

func AESDecryptCBC(key string, ciphertext []byte) (string, error)

func AESEncrypt

func AESEncrypt(key string, plaintext string) ([]byte, error)

func AESEncryptCBC

func AESEncryptCBC(key string, plaintext string) ([]byte, error)

func ASCII2Hex

func ASCII2Hex(s string) []byte

TODO: test

func ASCII2HexRev

func ASCII2HexRev(s string) []byte

func AbsInt

func AbsInt(i int) int

func AbsInt64

func AbsInt64(i int64) int64

func AddByte

func AddByte(one []byte, two byte) []byte

func AddPrivateKeys

func AddPrivateKeys(one, two string) *big.Int

func AddPrivateKeysReturnString

func AddPrivateKeysReturnString(one, two string) string

func AddPublicKeys

func AddPublicKeys(one, two string) (*big.Int, *big.Int)

func AddPublicKeysReturnString

func AddPublicKeysReturnString(one, two string) string

func AreHexesEqual

func AreHexesEqual(one, two []byte) bool

func AreStringsEqual

func AreStringsEqual(one, two string) bool

func Base582Hex

func Base582Hex(b string) []byte

convert base58 to hex bytes

func Base582HexStr

func Base582HexStr(b string) string

convert base58 to hex byte string

func Base582HexString

func Base582HexString(b string) string

convert base58 to hex byte string

func Base58LetterToInt

func Base58LetterToInt(letter string) int

func Base642Hex

func Base642Hex(s string) []byte

func Base64URLDecode

func Base64URLDecode(s string) string

func Base64URLEncode

func Base64URLEncode(s string) string

func Big2Hex

func Big2Hex(b *big.Int) []byte

TODO: test

func Big2HexPadded

func Big2HexPadded(b *big.Int, paddingSize int) []byte

func Big2HexRev

func Big2HexRev(b *big.Int) []byte

TODO: test

func Big2HexWithMinimumLength

func Big2HexWithMinimumLength(b *big.Int, length int) []byte

func Bits2Difficulty

func Bits2Difficulty(bits uint32) (float64, error)

TODO: test and add to tests

func Bits2Target

func Bits2Target(bits uint32) *big.Int

TODO: test and add to tests

func Bits2TargetHex

func Bits2TargetHex(bits uint32) []byte

TODO: test and add to tests

func Bits2TargetHexRev

func Bits2TargetHexRev(bits uint32) []byte

TODO: test and add to tests

func BitsRev2TargetHexRev

func BitsRev2TargetHexRev(bits uint32) []byte

TODO: test and add to tests

func BitsString2TargetHexRev

func BitsString2TargetHexRev(bits string) []byte

func Byte2String

func Byte2String(b []byte) string

func CalculateBitMidstate

func CalculateBitMidstate(data []byte) []byte

TODO: test and add to tests

func CalculateBountyForLavishnessAndComplexity

func CalculateBountyForLavishnessAndComplexity(lavishness float64, complexity float64) float64

func CalculateLavishness

func CalculateLavishness(bounty float64, complexity float64) float64

func CanPatternBeSolvedInNet

func CanPatternBeSolvedInNet(pattern string, netByte byte) bool

func CheckAddressStringValidity

func CheckAddressStringValidity(addr string) bool

func CheckAddressStringValidityWithNetByte

func CheckAddressStringValidityWithNetByte(addr string, netByte byte) bool

func CheckAddressValidity

func CheckAddressValidity(addr Base58) bool

func CheckAddressValidityWithNetByte

func CheckAddressValidityWithNetByte(addr Base58, netByte byte) bool

func CheckRippleAddressValidity

func CheckRippleAddressValidity(address string) bool

func CheckRippleSecretValidity

func CheckRippleSecretValidity(secret string, address string) bool

func CheckSolutionAddCompressed

func CheckSolutionAddCompressed(pubKey, solution, pattern string, netByte byte) (string, string)

func CheckSolutionAddUncompressed

func CheckSolutionAddUncompressed(pubKey, solution, pattern string, netByte byte) (string, string)

func CheckSolutionMultCompressed

func CheckSolutionMultCompressed(pubKey, solution, pattern string, netByte byte) (string, string)

func CheckSolutionMultUncompressed

func CheckSolutionMultUncompressed(pubKey, solution, pattern string, netByte byte) (string, string)

func Coin2Satoshi

func Coin2Satoshi(coin float64) int64

func ComparePrivateKeys

func ComparePrivateKeys(a string, b string) int

func ConcatBytes

func ConcatBytes(list ...[]byte) []byte

func Contains

func Contains(s string, sub string) bool

func DecodeJSON

func DecodeJSON(data []byte, v interface{}) error

func DecodeJSONString

func DecodeJSONString(data string, v interface{}) error

func DoesPatternHaveRightPrefix

func DoesPatternHaveRightPrefix(pattern string, netByte byte) bool

func DoesStringContain

func DoesStringContain(s string, substring string) bool

func DoesStringStartWith

func DoesStringStartWith(s string, prefix string) bool

func DoubleDoubleSHA

func DoubleDoubleSHA(a []byte, b []byte) []byte

TODO: test and add to tests double hash input bytes, double hash their concatanation

func DoubleSHA

func DoubleSHA(b []byte) []byte

TODO: test and add to tests double SHA-256 hashing of a single byte array

func DoubleSHAPair

func DoubleSHAPair(a []byte, b []byte) []byte

TODO: test and add to tests double SHA-256 hash of a concatenation of the two inputs

func DoubleSHAPairRev

func DoubleSHAPairRev(a []byte, b []byte) []byte

TODO: test and add to tests double SHA-256 hash of a concatenation of the reverse of two inputs

func DoubleSHARev

func DoubleSHARev(b []byte) []byte

TODO: test and add to tests reverse double SHA-256 hashing of a single byte array

func EncodeJSON

func EncodeJSON(data interface{}) ([]byte, error)

func EncodeJSONString

func EncodeJSONString(data interface{}) (string, error)

func FactorToPercentageString

func FactorToPercentageString(factor *inf.Dec) string

func Float2CurrencyStr

func Float2CurrencyStr(f float64) string

func Float2CurrencyString

func Float2CurrencyString(f float64) string

func Float2Int

func Float2Int(f float64) int64

func Float2Str

func Float2Str(f float64) string

func Float2String

func Float2String(f float64) string

func Float642Int64

func Float642Int64(f float64) int64

func Float642Str

func Float642Str(f float64) string

func Float642String

func Float642String(f float64) string

func Float64ToDec

func Float64ToDec(f float64) *inf.Dec

func GenerateBase58CheckString

func GenerateBase58CheckString(baseHex string, leadingByte string) string

func GenerateMerkleRoot

func GenerateMerkleRoot(leafs [][]byte) []byte

TODO: test and add to tests

func GenerateMerkleTree

func GenerateMerkleTree(leafs [][]byte) [][]byte

TODO: test and add to tests

func GenerateMerkleTreeFromString

func GenerateMerkleTreeFromString(leafs []string) []string

TODO: test and add to tests

func GenerateProofOfBurnAddress

func GenerateProofOfBurnAddress(addressRoot string, padding byte) (string, error)

func HMACSHA512

func HMACSHA512(key, data []byte) []byte

func Hex2ASCII

func Hex2ASCII(b []byte) string

TODO: test

func Hex2Base58Str

func Hex2Base58Str(val []byte) string

func Hex2Base58String

func Hex2Base58String(val []byte) string

func Hex2Base64

func Hex2Base64(b []byte) string

func Hex2Big

func Hex2Big(b []byte) *big.Int

func Hex2Int

func Hex2Int(b []byte) int

func Hex2Int64

func Hex2Int64(b []byte) int64

func Hex2Str

func Hex2Str(b []byte) string

func Hex2String

func Hex2String(b []byte) string

func Hex2Uint32

func Hex2Uint32(b []byte) uint32

func Hex2Uint64

func Hex2Uint64(b []byte) uint64

func HexIntStr2Dec

func HexIntStr2Dec(s string) *inf.Dec

func HexIntString2Dec

func HexIntString2Dec(s string) *inf.Dec

func HexRev2Big

func HexRev2Big(rev []byte) *big.Int

func HexRev2Str

func HexRev2Str(b []byte) string

func HexRev2String

func HexRev2String(b []byte) string

func HexRev2Uint32

func HexRev2Uint32(b []byte) uint32

func HexRev2Uint64

func HexRev2Uint64(b []byte) uint64

func HexString2Int64

func HexString2Int64(s string) int64

func Int2BitHex

func Int2BitHex(i int) []byte

TODO: test

func Int2Float

func Int2Float(i int64) float64

func Int2Hex

func Int2Hex(i int) []byte

func Int2Str

func Int2Str(i int) string

func Int2String

func Int2String(i int) string

func Int642Float64

func Int642Float64(i int64) float64

func Int642Hex

func Int642Hex(i64 int64) []byte

func Int642HexString

func Int642HexString(i int64) string

func Int642Str

func Int642Str(i int64) string

func Int642String

func Int642String(i int64) string

func IsBase58StringValid

func IsBase58StringValid(toCheck string) bool

func IsPrivateKeyOnCurve

func IsPrivateKeyOnCurve(privateKey string) bool

func IsPublicKeyValid

func IsPublicKeyValid(pubKey string) bool

func IsStringAValidEmailAddress

func IsStringAValidEmailAddress(s string) bool

func MD5

func MD5(b []byte) []byte

func MD5String

func MD5String(s string) string

func Makesecp256k1

func Makesecp256k1()

TODO: test and add to tests

func MapStringInt64ToString

func MapStringInt64ToString(m map[string]int64) string

func MaxAddressForNetByte

func MaxAddressForNetByte(netByte byte) string

func MaxInt

func MaxInt() int

func MaxInt64

func MaxInt64() int64

func MinAddressForNetByte

func MinAddressForNetByte(netByte byte) string

func MultiplyPrivateAndPublicKeyReturnString

func MultiplyPrivateAndPublicKeyReturnString(private, public string) string

func MultiplyPrivateKeys

func MultiplyPrivateKeys(one, two string) *big.Int

func MultiplyPrivateKeysReturnString

func MultiplyPrivateKeysReturnString(one, two string) string

func NewRandomPrivateKey

func NewRandomPrivateKey() string

func OneByte2String

func OneByte2String(b byte) string

func PadCBC

func PadCBC(b []byte) []byte

func PadHexToLength

func PadHexToLength(hex []byte, length int) []byte

func PointCoordinatesToPublicKey

func PointCoordinatesToPublicKey(x, y *big.Int) string

func PrivateKeyToCompressedAddress

func PrivateKeyToCompressedAddress(net string, privateKey string) string

func PrivateKeyToCompressedAddressBytes

func PrivateKeyToCompressedAddressBytes(net byte, privateKey []byte) string

func PrivateKeyToCompressedPublicKey

func PrivateKeyToCompressedPublicKey(privateKey string) string

func PrivateKeyToUncompressedAddress

func PrivateKeyToUncompressedAddress(net string, privateKey string) string

func PrivateKeyToUncompressedAddressBytes

func PrivateKeyToUncompressedAddressBytes(net byte, privateKey []byte) string

func PrivateKeyToUncompressedPublicKey

func PrivateKeyToUncompressedPublicKey(privateKey string) string

func PrivateKeyToWIF

func PrivateKeyToWIF(key string) string

func PrivateKeyToWIFWithPrefixByte

func PrivateKeyToWIFWithPrefixByte(key string, prefix byte) string

func PublicKeyToAddress

func PublicKeyToAddress(net string, key string) string

func PublicKeyToPointCoordinates

func PublicKeyToPointCoordinates(pubKey string) (*big.Int, *big.Int)

func RandFloat64

func RandFloat64() float64

func RandFloat64Between

func RandFloat64Between(min float64, max float64) float64

func RandInt

func RandInt() int

func RandInt64

func RandInt64() int64

func RandInt64Between

func RandInt64Between(min int64, max int64) int64

func RandInt64Positive

func RandInt64Positive() int64

func RandIntBetween

func RandIntBetween(min int, max int) int

func RandIntPositive

func RandIntPositive() int

func RandomAlphabetString

func RandomAlphabetString(length int, alphabet string) string

func RandomHex

func RandomHex(length int) []byte

func RandomHexString

func RandomHexString(length int) string

func Randuint64

func Randuint64() []byte

func Randuint64Rev

func Randuint64Rev() []byte

func Rev

func Rev(b []byte) []byte

TODO: use this function to reverse some of the below functions?

func RevTest

func RevTest() bool

func RevWords

func RevWords(b []byte) []byte

func RevWords2

func RevWords2(b []byte) []byte

func RevWords2Str

func RevWords2Str(b string) string

func RevWordsStr

func RevWordsStr(b string) string

func ReverseByteOrder

func ReverseByteOrder(b []byte) []byte

TODO: test

func Ripemd

func Ripemd(b []byte) []byte

TODO: test and add to tests RIPEMD-160 operation for bitcoin address hashing

func RipemdRev

func RipemdRev(b []byte) []byte

TODO: test and add to tests reverse RIPEMD-160 hash

func RippleAddressToStandardAddress

func RippleAddressToStandardAddress(address string) string

func RoundFloatUpToXSignificantDigits

func RoundFloatUpToXSignificantDigits(f float64, digits int) float64

func SHA256

func SHA256(b []byte) []byte

TODO: test and add to tests Single SHA-256 hashing of a single byte array

func SHA256ASCIIString

func SHA256ASCIIString(s string) string

func SHA256HexString

func SHA256HexString(s string) string

func SHA512

func SHA512(b []byte) []byte

func SHA512Half

func SHA512Half(b []byte) []byte

func SHA512HalfString

func SHA512HalfString(s string) string

func SHA512String

func SHA512String(s string) string

func SHARipemd

func SHARipemd(b []byte) []byte

TODO: test and add to tests SHA-256 RIPEMD-160 operation for bitcoin address hashing

func SHARipemdRev

func SHARipemdRev(b []byte) []byte

TODO: test and add to tests reverse SHA-256 RIPEMD-160 hash

func Satoshi2Coin

func Satoshi2Coin(satoshi int64) float64

func SeedHexToSeed

func SeedHexToSeed(hex string) string

func SeedToSeedHex

func SeedToSeedHex(seed string) []byte

func SeedToSeedHexString

func SeedToSeedHexString(seed string) string

func SignStringMessageWithPrivateKey

func SignStringMessageWithPrivateKey(message string, key string) string

func SingleSHA

func SingleSHA(b []byte) []byte

TODO: test and add to tests Single SHA-256 hashing of a single byte array

func SingleSHA1

func SingleSHA1(b []byte) []byte

TODO: test and add to tests Single SHA-1 hashing of a single byte array

func SingleSHA1Rev

func SingleSHA1Rev(b []byte) []byte

Reversed SHA-1 hashing of a single byte array TODO: test and add to tests

func SingleSHARev

func SingleSHARev(b []byte) []byte

TODO: test and add to tests Reversed single SHA-256 hashing of a single byte array

func SortStringList

func SortStringList(list []string)

func SplitStrings

func SplitStrings(str, separator string) []string

func StandardAddressToRippleAddress

func StandardAddressToRippleAddress(address string) string

func Str2Base64

func Str2Base64(s string) string

func Str2Big

func Str2Big(s string) *big.Int

TODO: test

func Str2BigBase

func Str2BigBase(s string, base int) *big.Int

TODO: test

func Str2Dec

func Str2Dec(s string) *inf.Dec

func Str2Float

func Str2Float(s string) float64

func Str2Float64

func Str2Float64(s string) float64

func Str2Hex

func Str2Hex(s string) []byte

func Str2HexRev

func Str2HexRev(s string) []byte

func Str2Int

func Str2Int(s string) int

func Str2Int64

func Str2Int64(s string) int64

func Str2Uint32

func Str2Uint32(s string) uint32

func String2Big

func String2Big(s string) *big.Int

TODO: test

func String2BigBase

func String2BigBase(s string, base int) *big.Int

TODO: test

func String2Dec

func String2Dec(s string) *inf.Dec

func String2Float

func String2Float(s string) float64

func String2Hex

func String2Hex(s string) []byte

func String2Hex32

func String2Hex32(s string) [32]byte

func String2HexRev

func String2HexRev(s string) []byte

func String2Int

func String2Int(s string) int

func String2Int64

func String2Int64(s string) int64

func StringToPrivateKey

func StringToPrivateKey(key string) []byte

func Target2Bits

func Target2Bits(target *big.Int) uint32

TODO: test and add to tests

func Target2Difficulty

func Target2Difficulty(target *big.Int) (float64, error)

TODO: test and add to tests

func TestBase58

func TestBase58()

TODO: do and test everything

func TestBitAddress

func TestBitAddress()

func TestBitsTargetDifficultyConversions

func TestBitsTargetDifficultyConversions() bool

TODO: expand and add to tests

func TestCanPatternBeSolvedInNet

func TestCanPatternBeSolvedInNet() bool

func TestCompile

func TestCompile() bool

func TestEverything

func TestEverything() bool

TODO: do

func TestEverythingBitmath

func TestEverythingBitmath() bool

func TestGenerateMerkleTree

func TestGenerateMerkleTree() bool

func TestLen

func TestLen() bool

func TestUnmarshall

func TestUnmarshall() string

func TestVarInt

func TestVarInt() bool

func TestVarInt2Hex

func TestVarInt2Hex() bool

func TestVarInt2HexRev

func TestVarInt2HexRev() bool

func TestVarStr

func TestVarStr() bool

func TestWillNetworkByteGivePrefix

func TestWillNetworkByteGivePrefix() bool

func ToLower

func ToLower(s string) string

func ToUpper

func ToUpper(s string) string

func TrimFloatToXDecimalDigits

func TrimFloatToXDecimalDigits(f float64, digits int) float64

func TrimFloatToXSignificantDigits

func TrimFloatToXSignificantDigits(f float64, digits int) float64

func TrimISO10126Padding

func TrimISO10126Padding(b []byte) []byte

func Uint162Hex

func Uint162Hex(ui uint16) []byte

func Uint162HexRev

func Uint162HexRev(ui uint16) []byte

func Uint2Hex

func Uint2Hex(ui uint) []byte

TODO: test

func Uint322Hex

func Uint322Hex(ui uint32) []byte

func Uint322HexRev

func Uint322HexRev(ui uint32) []byte

func Uint642Hex

func Uint642Hex(ui uint64) []byte

func Uint642HexRev

func Uint642HexRev(ui uint64) []byte

func UncompressedKeyToCompressedKey

func UncompressedKeyToCompressedKey(key string) string

func UnpadCBC

func UnpadCBC(b []byte) ([]byte, error)

func VanityAddressComplexity

func VanityAddressComplexity(pattern string) float64

func VanityAddressLavishness

func VanityAddressLavishness(pattern string, bounty float64) float64

func WillNetworkByteGivePrefix

func WillNetworkByteGivePrefix(b byte, prefix string) bool

Types

type Alphabetic

type Alphabetic []string

func (Alphabetic) Len

func (a Alphabetic) Len() int

func (Alphabetic) Less

func (a Alphabetic) Less(i, j int) bool

func (Alphabetic) Swap

func (a Alphabetic) Swap(i, j int)

type Base58

type Base58 string

type to hold the Base58 string

func Big2Base58

func Big2Base58(val *big.Int) Base58

encodes big.Int to base58 string

func Hex2Base58

func Hex2Base58(val []byte) Base58

encodes hex bytes into base58

func Int2Base58

func Int2Base58(val int) Base58

encodes int to base58 string

func Str2Hex58

func Str2Hex58(val string) Base58

func StrHex2Base58

func StrHex2Base58(val string) Base58

func String2Base58

func String2Base58(val string) Base58

func StringHex2Base58

func StringHex2Base58(val string) Base58

encodes string stored hex bytes into base58

func (Base58) Base582Big

func (b Base58) Base582Big() *big.Int

func (Base58) Base582Int

func (b Base58) Base582Int() int

convert base58 to int

func (Base58) BitHex

func (b Base58) BitHex() []byte

convert base58 to hexes used by Bitcoins (keeping the zeroes on the front, 25 bytes long)

func (Base58) ToBig

func (b Base58) ToBig() *big.Int

Convert base58 to big.Int

func (Base58) ToHex

func (b Base58) ToHex() []byte

convert base58 to hex bytes

func (Base58) ToInt

func (b Base58) ToInt() int

convert base58 to int

type BitAddress

type BitAddress struct {
	PrivateKey []byte //private key, can be encrypted
	Encrypted  bool   //checked if the private key is encrypted
	PublicKey  []byte //public key
	Hash160    []byte //RIPEMD hash
	Hash       []byte //RIPEMD with network bit and checksum
	Base       Base58 //base58 encoded address
}

structure to keep different encodings of the bitcoin adress

func NewAddressFromPrivateKey

func NewAddressFromPrivateKey(privateKey []byte) (*BitAddress, error)

func NewAddressFromPrivateKeyOtherNets

func NewAddressFromPrivateKeyOtherNets(netByte byte, privateKey []byte) (*BitAddress, error)

func NewAddressFromPrivateKeyWithCurve

func NewAddressFromPrivateKeyWithCurve(privateKey []byte, curve *bitelliptic.BitCurve) (*BitAddress, error)

func NewAddressFromPrivateKeyWithCurveOtherNets

func NewAddressFromPrivateKeyWithCurveOtherNets(netByte byte, privateKey []byte, curve *bitelliptic.BitCurve) (*BitAddress, error)

func NewFromBase

func NewFromBase(b Base58) *BitAddress

creates the structure to hold the base58 address

func NewFromBaseString

func NewFromBaseString(s string) *BitAddress

func NewFromPublicKey

func NewFromPublicKey(netbyte byte, key []byte) *BitAddress

TODO: do something for TESTnet? TODO: update and revise creates a bitcoin address from the public key

func NewFromPublicKeyString

func NewFromPublicKeyString(netByte byte, s string) *BitAddress

creates a new bitcoin address from a string representing a public key

func NewRandomAddress

func NewRandomAddress() (*BitAddress, error)

func NewRandomAddressOtherNets

func NewRandomAddressOtherNets(netByte byte) (*BitAddress, error)

func (BitAddress) CheckValidity

func (ba BitAddress) CheckValidity() bool

TODO: do check validity of bitcoin address

func (BitAddress) CheckValidityWithNetByte

func (ba BitAddress) CheckValidityWithNetByte(netByte byte) bool

type CoinAddress

type CoinAddress struct {
	NetByte               string
	PrivateKey            string
	PublicKeyCompressed   string
	PublicKeyUncompressed string
	AddressCompressed     string
	AddressUncompressed   string
}

func GenerateCoinVanityAddressWithNetbyte

func GenerateCoinVanityAddressWithNetbyte(c context.Context, pattern string, netbyte string) CoinAddress

func GenerateCompressedCoinVanityAddressWithNetbyte

func GenerateCompressedCoinVanityAddressWithNetbyte(c context.Context, pattern string, netbyte string) CoinAddress

func GenerateNewCoinAddress

func GenerateNewCoinAddress(netByte string) CoinAddress

func GenerateUncompressedCoinVanityAddressWithNetbyte

func GenerateUncompressedCoinVanityAddressWithNetbyte(c context.Context, pattern string, netbyte string) CoinAddress

func (*CoinAddress) GetWIFCompressed

func (ca *CoinAddress) GetWIFCompressed(prefixByte string) string

func (*CoinAddress) GetWIFUncompressed

func (ca *CoinAddress) GetWIFUncompressed(prefixByte string) string

type RippleAddress

type RippleAddress struct {
	AccountID     string
	MasterSeed    string
	MasterSeedHex string

	PrivateGenerator   string
	PublicGenerator    string
	PublicGeneratorHex string

	PrivateKey   string
	PublicKey    string
	PublicKeyHex string
}

func GenerateNewRippleAddress

func GenerateNewRippleAddress() RippleAddress

func GenerateRippleVanityAddress

func GenerateRippleVanityAddress(c context.Context, pattern string) RippleAddress

type VarInt

type VarInt uint64

func DecodeVarInt

func DecodeVarInt(b []byte) VarInt

TODO: test

func DecodeVarIntGiveRest

func DecodeVarIntGiveRest(b []byte) (VarInt, []byte)

TODO: check and add to tests

func (VarInt) Compile

func (vi VarInt) Compile() []byte

func (VarInt) Len

func (vi VarInt) Len() int

type VarStr

type VarStr struct {
	// contains filtered or unexported fields
}

func (*VarStr) Compile

func (vs *VarStr) Compile() []byte

func (*VarStr) Len

func (vs *VarStr) Len() int

func (*VarStr) Read

func (vs *VarStr) Read() string

func (*VarStr) Set

func (vs *VarStr) Set(newString string)

Directories

Path Synopsis
Package hash provides interfaces for hash functions.
Package hash provides interfaces for hash functions.
Package ecdsa implements the Elliptic Curve Digital Signature Algorithm, as defined in FIPS 186-3.
Package ecdsa implements the Elliptic Curve Digital Signature Algorithm, as defined in FIPS 186-3.
Package ripemd160 implements the RIPEMD-160 hash algorithm.
Package ripemd160 implements the RIPEMD-160 hash algorithm.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL