Documentation ¶
Index ¶
- Variables
- func Decode(input string) ([]byte, error)
- func DecodeBig(input string) (*big.Int, error)
- func DecodeBigFromBytesToUint64(data []byte) uint64
- func DecodeNoPrefix(input string) ([]byte, error)
- func DecodeUint64(input string) (uint64, error)
- func Encode(b []byte) string
- func EncodeBig(bigint *big.Int) string
- func EncodeInt64(i int64) string
- func EncodeNoPrefix(b []byte) string
- func EncodeUint64(i uint64) string
- func EncodeUint64BytesToHexString(number []byte) string
- func EncodeUint64ToBytes(number uint64) []byte
- func ExtractHex(s string) string
- func Has0xPrefix(input string) bool
Constants ¶
This section is empty.
Variables ¶
var ( ErrEmptyString = &decError{"empty hex string"} ErrSyntax = &decError{"invalid hex string"} ErrMissingPrefix = &decError{"hex string without 0x prefix"} ErrOddLength = &decError{"hex string of odd length"} ErrEmptyNumber = &decError{"hex string \"0x\""} ErrLeadingZero = &decError{"hex number with leading zero digits"} ErrUint64Range = &decError{"hex number > 64 bits"} ErrUintRange = &decError{fmt.Sprintf("hex number > %d bits", uintBits)} ErrBig256Range = &decError{"hex number > 256 bits"} )
Errors
Functions ¶
func DecodeBig ¶
DecodeBig decodes a hex string with 0x prefix as a quantity. Numbers larger than 256 bits are not accepted.
func DecodeBigFromBytesToUint64 ¶
DecodeBigFromBytesToUint64 decodes a byte array to uint64.
func DecodeNoPrefix ¶
DecodeNoPrefix decodes a hex string without 0x prefix.
func DecodeUint64 ¶
DecodeUint64 decodes a hex string with 0x prefix as a quantity.
func EncodeBig ¶
EncodeBig encodes bigint as a hex string with 0x prefix. The sign of the integer is ignored.
func EncodeInt64 ¶
EncodeInt64 encodes i as a hex string with 0x prefix.
func EncodeNoPrefix ¶
EncodeNoPrefix encodes b as a hex string without 0x prefix.
func EncodeUint64 ¶
EncodeUint64 encodes i as a hex string with 0x prefix.
func EncodeUint64BytesToHexString ¶
EncodeUint64ToBytes encodes a uint64 number to bytes.
func EncodeUint64ToBytes ¶
EncodeUint64ToBytes encodes a uint64 number to bytes.
func ExtractHex ¶ added in v1.1.5
ExtractHex hexadecimal value out of a string.
Types ¶
This section is empty.