basex

package
v0.64.11 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2024 License: MIT Imports: 5 Imported by: 2

Documentation

Index

Constants

View Source
const (
	AlphabetBase10          = "0123456789"
	AlphabetBase16          = "0123456789abcdef"
	AlphabetBase26          = "abcdefghijklmnopqrstuvwxyz"
	AlphabetBase31          = "0123456789BCDFGHJKLMNPQRSTVWXYZ"  // Gaming, no foul words
	AlphabetBase32          = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567" // RFC-4648: https://en.wikipedia.org/wiki/Base32
	AlphabetBase32Geohash   = "0123456789bcdefghjkmnpqrstuvwxyz"
	AlphabetBase32Hex       = "0123456789ABCDEFGHIJKLMNOPQRSTUV"
	AlphabetBase32Wordsafe  = "23456789CFGHJMPQRVWXcfghjmpqrvwx" // Word-safe alphabet to avoid forming words
	AlphabetBase32Z         = "ybndrfg8ejkmcpqxot1uwisza345h769"
	AlphabetBase36          = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
	AlphabetBase45          = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:"            // https://datatracker.ietf.org/doc/rfc9285/
	AlphabetBase56          = "0123456789ABCEFGHJKLMNPRSTUVWXYZabcdefghjklmnpqrstuvwxyz" // See: https://github.com/tep/encoding-base56
	AlphabetBase56Alt       = "23456789abcdefghijkmnpqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ" // used by Java and PHP
	AlphabetBase56Java      = AlphabetBase56Alt                                          // See: https://github.com/tep/encoding-base56
	AlphabetBase56PHP       = AlphabetBase56Alt                                          // See: https://github.com/tep/encoding-base56
	AlphabetBase56Python3   = "23456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnpqrstuvwxyz"
	AlphabetBase58          = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz" // Bitcoin alphabet: https://en.bitcoin.it/wiki/Base58Check_encoding
	AlphabetBase58Flickr    = "123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"
	AlphabetBase58GMP       = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuv"
	AlphabetBase58Ripple    = "rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz"
	AlphabetBase62          = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" // ASCII table, used by GMP
	AlphabetBase62Gobigint  = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
	AlphabetBase62LUN       = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
	AlphabetBase62ULN       = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"
	AlphabetBase63          = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_"
	AlphabetBase63Roblox    = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_" // Using traditional Roblox ordering (not for encoding)
	AlphabetBase64          = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
	AlphabetBase64IMAP      = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+,"
	AlphabetBase64URL       = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"
	AlphabetBase70AWSS3Safe = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!-_.*'()"                // https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-keys.html
	AlphabetBase85          = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz!#$%&()*+-;<=>?@^_`{|}~" // RFC-1924 https://en.wikipedia.org/wiki/Ascii85
)

Variables

View Source
var (
	ErrInvalidAlphaNumericAlphabet  = errors.New("invalid alphanumeric alphabet")
	ErrInvalidAlphabetHasDuplicates = errors.New("invalid alphabet has duplicates")
	ErrInvalidAlphabetIsEmpty       = errors.New("invalid alphabet is empty")
)

Functions

func AlphabetDefault

func AlphabetDefault(base uint) string

func AlphabetShuffled

func AlphabetShuffled(alphabet string) string

AlphabetShuffled shuffles an alphabet to provide a random ordering.

func IsAlphaNumericAlphabet

func IsAlphaNumericAlphabet(alphabet string) bool

func RuneMaps

func RuneMaps(alphabet string) (map[int]rune, map[rune]int)

RuneMaps produces maps of alphabets.

func ValidAlphabet

func ValidAlphabet(alphabet, s string) bool

ValidAlphabet checks to see if string `s` is within the supplied alphabet.

func ValidAlphabetMap

func ValidAlphabetMap(alphabet map[rune]int, s string) bool

ValidAlphabetMap checks to see if string `s` is within the supplied alphabet. Prefer this over `ValidAlphabet()` when calling many times.

func ValidAlphabets

func ValidAlphabets(a1, a2 string, a2optional bool) error

ValidAlphabets validates a pair of alphabets with the second being optional.

Types

This section is empty.

Jump to

Keyboard shortcuts

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