encode

package
v2.0.4 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Alphabet added in v2.0.2

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

type BaseType added in v2.0.2

type BaseType int

BaseType defines supported base encoding formats.

const (
	Base58 BaseType = iota // Base58 encoding (commonly used in Bitcoin addresses)
	Base62                 // Base62 encoding (compact, URL-safe)
	Base64                 // Base64 encoding (standard in web/data transfer)
)

type Encoding added in v2.0.2

type Encoding interface {
	Encode([]byte) ([]byte, error)    // Encode input bytes to encoded bytes
	EncodeStr(string) (string, error) // Encode input string to encoded string
	Decode([]byte) ([]byte, error)    // Decode encoded bytes to original bytes
	DecodeStr(string) (string, error) // Decode encoded string to original string
}

Encoding defines a common interface for encoding and decoding operations. Implementations must support both byte-level and string-level operations.

func NewEncoding added in v2.0.2

func NewEncoding(base BaseType) Encoding

NewEncoding returns an Encoding implementation based on the selected BaseType. It supports Base58, Base62, and Base64 encodings. Returns nil if base is unsupported.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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