Documentation ¶
Index ¶
- Variables
- func AddChecksumToBytes(data []byte) ([]byte, error)
- func AddPrivateKeys(key1 []byte, key2 []byte) []byte
- func AddPublicKeys(key1 []byte, key2 []byte) []byte
- func B58AddressToHash160(address string) (hash160 []byte, addrType int, err error)
- func Checksum(data []byte) ([]byte, error)
- func Hash160(data []byte) ([]byte, error)
- func Hash160ToB58Address(hash160 []byte, addrType int) (string, error)
- func HashDoubleSha256(data []byte) ([]byte, error)
- func HashRipeMD160(data []byte) ([]byte, error)
- func HashSha256(data []byte) ([]byte, error)
- func Int64ToBytes(i int64) []byte
- func IsB58Address(address string) bool
- func PublicKeyForPrivateKey(key []byte) []byte
- func Uint16Bytes(i uint16) []byte
- func Uint32Bytes(i uint32) []byte
- func ValidateChecksum(data []byte) ([]byte, error)
- func ValidateChildPublicKey(key []byte) error
- func ValidatePrivateKey(key []byte) error
- func WIFDecode(key string) (prefix int, secret []byte, compressed bool, err error)
- func WIFEncode(prefix int, secret []byte, compressed bool) (string, error)
- type Encoding
- func (enc *Encoding) Base() int
- func (enc *Encoding) DecodeString(s string) ([]byte, error)
- func (enc *Encoding) DecodeStringN(s string, n int) ([]byte, error)
- func (enc *Encoding) EncodeToString(b []byte) string
- func (enc *Encoding) MustRandom(n int) string
- func (enc *Encoding) Random(n int) (string, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var ( PublicKeyCompressedLength = 33 // ErrInvalidPrivateKey is returned when a derived private key is invalid ErrInvalidPrivateKey = errors.New("Invalid private key") // ErrInvalidPublicKey is returned when a derived public key is invalid ErrInvalidPublicKey = errors.New("Invalid public key") )
View Source
var Base58 = NewEncoding(bitcoinBase58Alphabet)
View Source
var ( // ErrInvalidChecksum is returned when deserializing a key with an incorrect // checksum ErrInvalidChecksum = errors.New("Checksum doesn't match") )
Functions ¶
func AddChecksumToBytes ¶
func AddPrivateKeys ¶
func AddPublicKeys ¶
func B58AddressToHash160 ¶
func HashDoubleSha256 ¶
func HashRipeMD160 ¶
func HashSha256 ¶
func Int64ToBytes ¶
func IsB58Address ¶
func PublicKeyForPrivateKey ¶
func Uint16Bytes ¶
func Uint32Bytes ¶
func ValidateChecksum ¶
func ValidateChildPublicKey ¶
func ValidatePrivateKey ¶
Types ¶
type Encoding ¶
type Encoding struct {
// contains filtered or unexported fields
}
Encoding represents a given base-N encoding.
func NewEncoding ¶
NewEncoding creates a new base-N representation from the given alphabet. Panics if the alphabet is not unique. Only ASCII characters are supported.
func (*Encoding) DecodeString ¶
DecodeString returns the bytes for the given base-encoded string.
func (*Encoding) DecodeStringN ¶
DecodeStringN returns N bytes for the given base-encoded string. Use this method to ensure the value is left-padded with zeroes.
func (*Encoding) EncodeToString ¶
EncodeToString returns the base-encoded string representation of the given bytes.
func (*Encoding) MustRandom ¶
MustRandom returns the base-encoded representation of n random bytes, panicking in the unlikely event of a read error from the random source.
Click to show internal directories.
Click to hide internal directories.