Documentation ¶
Overview ¶
Package basen implements a radix encoding/decoding scheme, defined by a n-character alphabet.
Index ¶
- Variables
- type Encoding
- func (e *Encoding) DecodeString(s string) ([]byte, error)
- func (e *Encoding) DecodeStringToBigInt(s string) (*big.Int, error)
- func (e *Encoding) DecodeStringToInt64(s string) (int64, error)
- func (e *Encoding) DecodedLen(n int) int
- func (e *Encoding) EncodeBigIntToString(src *big.Int) string
- func (e *Encoding) EncodeInt64ToString(n int64) string
- func (e *Encoding) EncodeToString(src []byte) string
- func (e *Encoding) EncodedLen(n int) int
Constants ¶
This section is empty.
Variables ¶
var Base58Encoding = NewEncoding("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz")
Base58Encoding is the standard base58 encoding, which is the alternate base64 encoding defined in RFC 4648 modified to avoid both non-alphanumeric characters and letters which might look ambiguous when printed. It is designed for human users who manually enter the data, copying from some visual source, but also allows easy copy and paste because a double-click will usually select the whole string, and it is safe to include in a URL with escaping.
var Base62Encoding = NewEncoding("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")
Base62Encoding is the standard base62 encoding, which is the standard base64 encoding defined in RFC 4648 modified to avoid non-alphanumeric characters. It is useful for generating strings that are safe to include in URLs, and allows easy copy and paste because a double-click will usually select the whole string.
Functions ¶
This section is empty.
Types ¶
type Encoding ¶
type Encoding struct {
// contains filtered or unexported fields
}
An Encoding is a radix encoding/decoding scheme, defined by a n-character alphabet.
func NewEncoding ¶
NewEncoding returns a new Encoding defined by the given alphabet.
func (*Encoding) DecodeString ¶
DecodeString returns the bytes represented by the encoded string s.
func (*Encoding) DecodeStringToBigInt ¶
DecodeStringToBigInt returns the big.Int represented by the encoded string s.
func (*Encoding) DecodeStringToInt64 ¶
DecodeStringToInt64 returns the int64 represented by the encoded string s.
func (*Encoding) DecodedLen ¶
DecodedLen returns the maximum length in bytes of the decoded data corresponding to n bytes of encoded data.
func (*Encoding) EncodeBigIntToString ¶
EncodeBigIntToString returns the encoding of src.
func (*Encoding) EncodeInt64ToString ¶
EncodeInt64ToString returns the encoding of n.
func (*Encoding) EncodeToString ¶
EncodeToString returns the encoding of src.
func (*Encoding) EncodedLen ¶
EncodedLen returns the length in bytes of the encoding of an input buffer of length n.