Documentation
¶
Overview ¶
Package base58 implements a human-friendly base58 encoding.
As opposed to base64 and friends, base58 is typically used to convert integers. You can use big.Int.SetBytes to convert arbitrary bytes to an integer first, and big.Int.Bytes the other way around.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var DecodeToBig func([]byte) (*big.Int, error) = DefaultEncoding.DecodeToBig
Decode a big integer from the bytes. Returns an error on corrupt input. This is a shortcut to DefaultEncoding.DecodeToBig. It's suggested for maintainability reasons to use the full reference in new code.
var DefaultEncoding = NewEncoder(caps_last_alphabet)
Uses alphabet "123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ" Default for compatibility reasons. The "EncodeBig" and "DecodeToBig" top-level functions are just shortcuts for methods on this encoding.
var EncodeBig func([]byte, *big.Int) []byte = DefaultEncoding.EncodeBig
Encode encodes src, appending to dst. Be sure to use the returned new value of dst. This is a shortcut to DefaultEncoding.EncodeBig. It's suggested for maintainability reasons to use the full reference in new code.
var StdEncoding = NewEncoder(caps_first_alphabet)
Uses alphabet "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz" Standard because it appears to be in wider use, v/v miniLock, Bitcoin, Python's base58, etc.
Functions ¶
func NewEncoder ¶
func NewEncoder(alphabet string) *encodingAlphabet
If a custom alphabet is desired it can be defined here by passing a length 62 string of unique characters. Two encodings are provided in this library already, representing "caps first" or "caps last" base58.
Types ¶
type CorruptInputError ¶
type CorruptInputError int64
func (CorruptInputError) Error ¶
func (e CorruptInputError) Error() string