basex

package
v1.0.3001 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Base2Key         = "01"
	Base16Key        = "0123456789ABCDEF"
	Base16InvalidKey = "0123456789abcdef"
	Base32Key        = "0123456789ABCDEFGHJKMNPQRSTVWXYZ"
	Base58Key        = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"
	Base62Key        = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
	Base62_2Key      = "vPh7zZwA2LyU4bGq5tcVfIMxJi6XaSoK9CNp0OWljYTHQ8REnmu31BrdgeDkFs"
	Base62InvalidKey = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
)

常用 key

Variables

View Source
var (
	// 编码类型
	Base2Encoding            = NewEncoding(Base2Key)
	Base16Encoding           = NewEncoding(Base16Key)
	Base16InvalidKeyEncoding = NewEncoding(Base16InvalidKey)
	Base32Encoding           = NewEncoding(Base32Key)
	Base58Encoding           = NewEncoding(Base58Key)
	Base62Encoding           = NewEncoding(Base62Key)
	Base62_2Encoding         = NewEncoding(Base62_2Key)
	Base62InvalidEncoding    = NewEncoding(Base62InvalidKey)
)

Functions

This section is empty.

Types

type Encoding added in v1.0.3001

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

Basex

func NewEncoding

func NewEncoding(alphabet string) *Encoding

构造函数 Example alphabets:

  • base2: 01
  • base16: 0123456789abcdef
  • base32: 0123456789ABCDEFGHJKMNPQRSTVWXYZ
  • base58: 123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz
  • base62: 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz

func (*Encoding) Decode added in v1.0.3001

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

解码

func (*Encoding) DecodeString added in v1.0.3001

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

DecodeString returns the bytes represented by the basex string s.

func (*Encoding) Encode added in v1.0.3001

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

编码

func (*Encoding) EncodeToString added in v1.0.3001

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

EncodeToString returns the basex encoding of src.

Jump to

Keyboard shortcuts

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