encoding

package
v1.1.5 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2019 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Base2 alphabet
	Base2 = "01"
	// Base16 alphabet
	Base16 = "0123456789abcdef"
	// Base32 alphabet
	Base32 = "0123456789ABCDEFGHJKMNPQRSTVWXYZ"
	// Base62 alphabet
	Base62 = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Encoding

type Encoding struct {
	// contains filtered or unexported fields
}

Encoding is a custom base encoding defined by an alphabet

func NewEncoding

func NewEncoding(alphabet string) (*Encoding, error)

NewEncoding returns a custom base encoder defined by the alphabet string

func (*Encoding) Decode

func (e *Encoding) Decode(source string) ([]byte, error)

Decode function decodes a string previously obtained from Encode, using the same alphabet and returns a byte slice

func (*Encoding) Encode

func (e *Encoding) Encode(source []byte) string

Encode function receives a byte slice and encodes it to a string using the alphabet provided

Jump to

Keyboard shortcuts

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