base58

package module
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2023 License: MIT Imports: 3 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// ChecksumSize is a size of checksum in bytes.
	ChecksumSize = 4

	// VersionSize is a size of version in bytes.
	VersionSize = 1
)
View Source
const (
	ErrChecksumMismatchMsg = "checksum mismatch"
	ErrInvalidFormatMsg    = "invalid format"
	ErrUnknownFormatMsg    = "unknown format"
)
View Source
const (
	// Alphabet is the modified base58 alphabet.
	Alphabet = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"
)

Variables

This section is empty.

Functions

func CheckDecode

func CheckDecode(blob []byte) ([]byte, byte, error)

CheckDecode decodes a string that was encoded with CheckEncode and verifies the checksum.

func CheckEncode

func CheckEncode(b []byte, ver byte) string

CheckEncode prepends a version byte and appends a four byte checksum.

func Checksum

func Checksum(blob []byte) (checksum [ChecksumSize]byte)

Checksum returns first of ChecksumSize bytes of SHA256 double-hash over provided bytes.

func Decode

func Decode(blob []byte) ([]byte, error)

Decode decodes base58 encoded bytes.

func DecodeString

func DecodeString(s string) ([]byte, error)

DecodeString decodes base58 encoded string to bytes.

func Encode

func Encode(blob []byte) []byte

Encode encodes given bytes to base58 encoded bytes.

func EncodeToString

func EncodeToString(b []byte) string

EncodeToString encodes given bytes to base58 encoded string.

func ErrChecksumMismatch

func ErrChecksumMismatch() error

func ErrInvalidFormat

func ErrInvalidFormat() error

func ErrUnknownFormat

func ErrUnknownFormat() error

Types

This section is empty.

Jump to

Keyboard shortcuts

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