Documentation
¶
Index ¶
- Variables
- func CheckDecode(input string) (result []byte, version byte, err error)
- func CheckEncode(input []byte, version byte) string
- type Encoding
- func (enc *Encoding) Decode(src []byte) ([]byte, error)
- func (enc *Encoding) DecodeString(src string) ([]byte, error)
- func (enc *Encoding) DecodedLen(n int) int
- func (enc *Encoding) Encode(b []byte) []byte
- func (enc *Encoding) EncodeToString(src []byte) string
- func (enc *Encoding) EncodedLen(n int) int
Constants ¶
This section is empty.
Variables ¶
var ErrChecksum = errors.New("checksum error")
var ErrInvalidFormat = errors.New("invalid format: version and/or checksum bytes missing")
var StdEncoding = NewEncoding(alphabet)
Functions ¶
Types ¶
type Encoding ¶ added in v1.0.3000
type Encoding struct {
// contains filtered or unexported fields
}
An Encoding is a base 58 encoding/decoding scheme defined by a 58-character alphabet.
func NewEncoding ¶ added in v1.0.3000
NewEncoding returns a new Encoding defined by the given alphabet, which must be a 58-byte string that does not contain CR or LF ('\r', '\n').
func (*Encoding) Decode ¶ added in v1.0.3000
Decode decodes src using the encoding enc. It writes at most DecodedLen(len(src)) bytes to dst and returns the number of bytes written. If src contains invalid base58 data, it will return the number of bytes successfully written and CorruptInputError.
func (*Encoding) DecodeString ¶ added in v1.0.3000
DecodeString returns the bytes represented by the base58 string s.
func (*Encoding) DecodedLen ¶ added in v1.0.3000
DecodedLen returns the maximum length in bytes of the decoded data corresponding to n bytes of base58-encoded data.
func (*Encoding) EncodeToString ¶ added in v1.0.3000
EncodeToString returns the base58 encoding of src.
func (*Encoding) EncodedLen ¶ added in v1.0.3000
EncodedLen returns an upper bound on the length in bytes of the base58 encoding of an input buffer of length n. The true encoded length may be shorter.