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 DecodeHex(s string) ([]byte, error)
- func DecodeHexZeroX(in string) ([]byte, error)
- func DecodeMnemonicAlgorand(src string) ([]byte, error)
- func EncodeBase32(src []byte) string
- func EncodeBase58(src []byte) string
- func EncodeHex(src []byte) string
- func EncodeHexZeroX(src []byte) (encoded string)
- func EncodeMnemonicAlgorand(src []byte) (string, error)
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" // KindBase58SubstrateAddress encoding value. KindBase58SubstrateAddress = "base58/ss58-address" // KindMnemonicAlgorand encoding value. KindMnemonicAlgorand = "mnemonic/algorand" )
Variables ¶
This section is empty.
Functions ¶
func Decode ¶ added in v0.0.70
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 ¶ added in v0.0.70
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 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 DecodeMnemonicAlgorand ¶ added in v0.0.70
DecodeMnemonicAlgorand returns the bytes represented by the word list as specified by BIP39 as per the algorand implementation.
DecodeMnemonicAlgorand expects that src contain exactly 25 words, all words MUST be in BIP39 word list and are space delimeted. If the input is malformed, DecodeMnemonicAlgorand returns an error.
func EncodeBase32 ¶ added in v0.0.70
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 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 EncodeMnemonicAlgorand ¶ added in v0.0.70
EncodeMnemonicAlgorand returns the string represented as BIP39 word list as per the Algorand implementation.
EncodeMnemonicAlgorand expects that src contains only base58 byte. If the input is malformed, EncodeBase58 returns an error.
Types ¶
This section is empty.