Documentation
¶
Overview ¶
Package encoding provides various encoding utilities for cryptocurrency addresses
Index ¶
- func Base32StdDecode(s string) ([]byte, error)
- func Base32StdEncode(data []byte) string
- func Base58CheckDecode(input string) (version byte, payload []byte, err error)
- func Base58CheckEncode(version byte, payload []byte) string
- func Base58Decode(input string) ([]byte, error)
- func Base58Encode(input []byte) string
- func Bech32Decode(bech string) (string, []byte, error)
- func Bech32Encode(hrp string, data []byte) (string, error)
- func CRC16XMODEM(data []byte) uint16
- func ConvertBits(data []byte, fromBits, toBits int, pad bool) ([]byte, error)
- func EncodeCashAddr(prefix string, addrType CashAddrType, hash []byte) (string, error)
- func SS58Decode(address string) (network byte, publicKey []byte, err error)
- func SS58Encode(publicKey []byte, network byte) (string, error)
- type CashAddrType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Base32StdDecode ¶ added in v1.1.0
Base32StdDecode decodes standard Base32 string (handles missing padding)
func Base32StdEncode ¶ added in v1.1.0
Base32StdEncode encodes bytes to standard Base32 (no padding) - used by Stellar
func Base58CheckDecode ¶
Base58CheckDecode decodes and verifies the checksum
func Base58CheckEncode ¶
Base58CheckEncode encodes with a 4-byte checksum (used in Bitcoin addresses)
func Base58Decode ¶
Base58Decode decodes a Base58 string to a byte slice
func Base58Encode ¶
Base58Encode encodes a byte slice to a Base58 string
func Bech32Decode ¶ added in v1.1.0
Bech32Decode decodes a bech32 string into hrp and data
func Bech32Encode ¶ added in v1.1.0
Bech32Encode encodes data with a human-readable part into a bech32 string
func CRC16XMODEM ¶ added in v1.1.0
CRC16XMODEM computes CRC-16/XMODEM checksum
func ConvertBits ¶ added in v1.1.0
ConvertBits converts data between bit groups (exported version)
func EncodeCashAddr ¶
func EncodeCashAddr(prefix string, addrType CashAddrType, hash []byte) (string, error)
EncodeCashAddr encodes a hash to CashAddr format
func SS58Decode ¶ added in v1.1.0
SS58Decode decodes an SS58 address to network prefix and public key
Types ¶
type CashAddrType ¶
type CashAddrType byte
CashAddrType represents the type of CashAddr
const ( CashAddrTypeP2PKH CashAddrType = 0 CashAddrTypeP2SH CashAddrType = 1 )
func DecodeCashAddr ¶
func DecodeCashAddr(address string) (prefix string, addrType CashAddrType, hash []byte, err error)
DecodeCashAddr decodes a CashAddr to its components