base58

package
v1.0.3003 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 8, 2025 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrChecksum = errors.New("checksum error")
View Source
var ErrInvalidFormat = errors.New("invalid format: version and/or checksum bytes missing")
View Source
var StdEncoding = NewEncoding(alphabet)

Functions

func CheckDecode

func CheckDecode(input string) (result []byte, version byte, err error)

Check Decode

func CheckEncode

func CheckEncode(input []byte, version byte) string

Check Encode

Types

type CorruptInputError added in v1.0.3001

type CorruptInputError int64

func (CorruptInputError) Error added in v1.0.3001

func (e CorruptInputError) Error() string

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

func NewEncoding(encoder string) *Encoding

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

func (enc *Encoding) Decode(src []byte) ([]byte, error)

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

func (enc *Encoding) DecodeString(s string) ([]byte, error)

DecodeString returns the bytes represented by the base58 string s.

func (*Encoding) Encode added in v1.0.3000

func (enc *Encoding) Encode(b []byte) []byte

Encode encodes src using the encoding enc.

func (*Encoding) EncodeToString added in v1.0.3000

func (enc *Encoding) EncodeToString(src []byte) string

EncodeToString returns the base58 encoding of src.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL