Documentation ¶
Index ¶
- Constants
- func DataPrefix() []byte
- func Decode(encoding, src string) ([]byte, error)
- func DecodeBase32(src string) ([]byte, error)
- func DecodeBase58(src string) ([]byte, error)
- func DecodeBase64(src string) ([]byte, error)
- func DecodeBase64URL(src string) ([]byte, error)
- func DecodeHex(s string) ([]byte, error)
- func DecodeHexZeroX(in string) ([]byte, error)
- func DecodeUTF8(src string) []byte
- func Encode(encoding string, src []byte) (string, error)
- func EncodeBase32(src []byte) string
- func EncodeBase58(src []byte) string
- func EncodeBase64(src []byte) string
- func EncodeBase64URL(src []byte) string
- func EncodeHex(src []byte) string
- func EncodeHexZeroX(src []byte) (encoded string)
- func EncodeUTF8(src []byte) string
Constants ¶
const ( // KindHex encoding value. KindHex = "hex/plain" // KindHex0XPrefix encoding value. KindHex0XPrefix = "hex/0x-prefix" // KindBase32 encoding value. KindBase32 = "base32/plain" // KindBase58 encoding value. KindBase58 = "base58/plain" // KindBase64 encoding value. KindBase64 = "base64/plain" // KindBase64URL encoding value. KindBase64URL = "base64/url" // KindBase58SubstrateAddress encoding value. KindBase58SubstrateAddress = "base58/ss58-address" // KindUTF8 encoding value. KindUTF8 = "text/utf-8" )
Variables ¶
This section is empty.
Functions ¶
func Decode ¶
Decode returns the bytes represented by the decoded string src.
Decode uses the decode method mapped to kind parameter. If the input is kind is unknown or the input is malformed for the decode method it returns an error.
func DecodeBase32 ¶
DecodeBase32 returns the bytes represented by the base32 string src.
DecodeBase32 expects that src contains only base32 characters. If the input is malformed, DecodeBase32 returns an error.
func DecodeBase58 ¶
DecodeBase58 returns the bytes represented by the base58 string src.
DecodeBase58 expects that src contains only base58 characters. If the input is malformed, DecodeBase58 returns an error.
func DecodeBase64 ¶
DecodeBase64 returns the bytes represented by the base64 string src.
DecodeBase64 expects that src contains only base64 characters. If the input is malformed, DecodeBase64 returns an error.
func DecodeBase64URL ¶
DecodeBase64URL returns the bytes represented by the base64 string src. This method decodes without padding.
func DecodeHex ¶
DecodeHex returns the bytes represented by the hexadecimal string s.
DecodeHex expects that src contains only hexadecimal characters and that src has even length. If the input is malformed, DecodeString returns the bytes decoded before the error.
func DecodeHexZeroX ¶
DecodeHexZeroX returns the bytes represented by the hexadecimal string src.
DecodeHexZeroX expects that src contains only hex characters and must contain a `0x` prefix. If the input is malformed, DecodeHexZeroX returns an error.
func DecodeUTF8 ¶
func EncodeBase32 ¶
EncodeBase32 returns the string represented by the base32 byte src.
EncodeBase32 expects that src contains only base32 byte. If the input is malformed, EncodeBase32 returns an error.
func EncodeBase58 ¶
EncodeBase58 returns the string represented by the base58 byte src.
EncodeBase58 expects that src contains only base58 byte. If the input is malformed, EncodeBase58 returns an error.
func EncodeBase64 ¶
EncodeBase64 returns the string represented by the base64 byte src.
EncodeBase64 expects that src contains only base64 byte. If the input is malformed, EncodeBase64 returns an error.
func EncodeBase64URL ¶
EncodeBase64URL returns the string represented by the base64 byte src. This method encodes without padding.
func EncodeHexZeroX ¶
EncodeHexZeroX encodes src into "0x"+hex.Encode. As a convenience, it returns the encoding type used, but this value is always TypeHex0XPrefix. EncodeHexZeroX uses hexadecimal encoding prefixed with "0x".
func EncodeUTF8 ¶
Types ¶
This section is empty.