Documentation ¶
Overview ¶
Package base58 implements base58 encoding.
It pre-defines encoding alphabets as used by Bitcoin and Ripple addresses as well as for Flickr short URLs.
Base58 is not a computationaly efficient encoding. Unless you have a need for compaitbility with a pre-existing scheme (e.g. Bitcoin, Ripple, or Flickr) then use another encoding such as base32 or base64. Under no circumstances should base58 be considered where the encoded data is of arbitrary size; encoding/decoding data of length n is ~O(n²).
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Bitcoin = New("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz")
Bitcoin is the encoding scheme used for Bitcoin addresses.
var Flickr = New("123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ")
Flickr is the encoding scheme used for Flickr's short URLs.
var Ripple = New("rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz")
Ripple is the encoding scheme used for Ripple addresses.
Functions ¶
This section is empty.
Types ¶
type CorruptInputError ¶
type CorruptInputError int
A CorruptInputError is reported for invalid base58 input.
func (CorruptInputError) Error ¶
func (e CorruptInputError) Error() string
type Encoding ¶
type Encoding struct {
// contains filtered or unexported fields
}
func New ¶
New returns a new Encoding defined by the given alphabet, which must be a 58-byte string.
func (*Encoding) AppendDecode ¶
AppendDecode appends the decoded value of the base58 encoded src to dst and returns the extended buffer.
AppendDecode returns CorruptInputError if src contains characters outside the encoding alphabet.
func (*Encoding) AppendDecodeString ¶
AppendDecodeString appends the decoded value of the base58 encoded s to dst and returns the extended buffer.
AppendDecodeString returns CorruptInputError if s contains characters outside the encoding alphabet.
func (*Encoding) AppendEncode ¶
AppendEncode appends the base58 encoding of src to dst and returns the extended buffer.