Documentation ¶
Index ¶
- Constants
- Variables
- func DecodeHex(str string) ([]byte, error)
- func DecodeHexToBig(hexNum string) *big.Int
- func DecodeNibble(in byte) uint64
- func DecodeString(str string) ([]byte, error)
- func EncodeBig(bigint *big.Int) string
- func EncodeToHex(str []byte) string
- func EncodeToString(str []byte) string
- func EncodeUint64(i uint64) string
- func MustDecodeHex(str string) []byte
- type DecError
Constants ¶
View Source
const BadNibble = ^uint64(0)
BadNibble is a nibble that is bad
View Source
const (
// Base represents the hexadecimal base, which is 16
Base = 16
)
Variables ¶
View Source
var ( ErrSyntax = &DecError{"invalid hex string"} ErrMissingPrefix = &DecError{"hex string without 0x prefix"} ErrEmptyNumber = &DecError{"hex string \"0x\""} ErrLeadingZero = &DecError{"hex number with leading zero digits"} ErrUint64Range = &DecError{"hex number > 64 bits"} ErrBig256Range = &DecError{"hex number > 256 bits"} )
TODO Remove
Functions ¶
func DecodeHexToBig ¶
DecodeHexToBig converts a hex number to a big.Int value
func DecodeString ¶
DecodeString returns the byte representation of the hexadecimal string
func EncodeBig ¶
EncodeBig encodes bigint as a hex string with 0x prefix. The sign of the integer is ignored.
func EncodeToHex ¶
EncodeToHex generates a hex string based on the byte representation, with the '0x' prefix
func EncodeToString ¶
EncodeToString is a wrapper method for hex.EncodeToString
func EncodeUint64 ¶
EncodeUint64 encodes a number as a hex string with 0x prefix.
func MustDecodeHex ¶
MustDecodeHex type-checks and converts a hex string to a byte array
Types ¶
Click to show internal directories.
Click to hide internal directories.