Documentation ¶
Index ¶
- Variables
- func ChecksumFirst4Bytes(data []byte, isNewCheckSum bool) (ckSum []byte)
- func Decode(str string) ([]byte, error)
- func DecodeCheck(input string) (result []byte, version byte, err error)
- func Encode(bin []byte) string
- func EncodeCheck(input []byte) string
- func FastBase58Decoding(str string) ([]byte, error)
- func FastBase58DecodingAlphabet(str string, alphabet *Alphabet) ([]byte, error)
- func FastBase58Encoding(bin []byte) string
- func FastBase58EncodingAlphabet(bin []byte, alphabet *Alphabet) string
- type Alphabet
- type Base58
- type Base58Check
Constants ¶
This section is empty.
Variables ¶
var BTCAlphabet = NewAlphabet("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz")
BTCAlphabet is the bitcoin base58 alphabet.
var ErrChecksum = errors.New("checksum error")
ErrChecksum indicates that the checksum of a check-encoded string does not verify against the checksum.
var ErrInvalidFormat = errors.New("invalid format: version and/or checksum bytes missing")
ErrInvalidFormat indicates that the check-encoded string has an invalid format.
var FlickrAlphabet = NewAlphabet("123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ")
FlickrAlphabet is the flickr base58 alphabet.
Functions ¶
func ChecksumFirst4Bytes ¶
ChecksumFirst4Bytes receives data in bytes array and returns a checksum which is 4 first bytes of hashing of data.
If isNewCheckSum, double SHA256 will be employed. Otherwise, single SHA3 will be employed.
func EncodeCheck ¶
func FastBase58Decoding ¶
FastBase58Decoding decodes the base58 encoded bytes.
func FastBase58DecodingAlphabet ¶
FastBase58DecodingAlphabet decodes the base58 encoded bytes using the given b58 alphabet.
func FastBase58Encoding ¶
FastBase58Encoding encodes the passed bytes into a base58 encoded string.
func FastBase58EncodingAlphabet ¶
FastBase58EncodingAlphabet encodes the passed bytes into a base58 encoded string with the passed alphabet.
Types ¶
type Alphabet ¶
type Alphabet struct {
// contains filtered or unexported fields
}
Alphabet is a a b58 alphabet.
func NewAlphabet ¶
NewAlphabet creates a new alphabet from the passed string.
It panics if the passed string is not 58 bytes long or isn't valid ASCII.
type Base58 ¶
type Base58 struct { }
type Base58Check ¶
type Base58Check struct { }
func (Base58Check) Decode ¶
func (self Base58Check) Decode(input string) (result []byte, version byte, err error)
Decode decodes a string that was encoded with Encode and verifies the checksum.
The Decode function allows to decode both old and new base58-encoded strings.