hex

package
v0.0.0-...-383178a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 28, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const BadNibble = ^uint64(0)

Variables

This section is empty.

Functions

func DecodeHex

func DecodeHex(str string) ([]byte, error)

DecodeHex converts a hex string to a byte array

func DecodeHexToBig

func DecodeHexToBig(hexNum string) *big.Int

DecodeHexToBig converts a hex number to a big.Int value

func DecodeNibble

func DecodeNibble(in byte) uint64

DecodeNibble decodes a byte into a uint64

func DecodeString

func DecodeString(str string) ([]byte, error)

DecodeString returns the byte representation of the hexadecimal string

func DecodeUint64

func DecodeUint64(hexStr string) (uint64, error)

DecodeUint64 decodes a hex string with 0x prefix to uint64

func DropHexPrefix

func DropHexPrefix(input []byte) []byte

func EncodeBig

func EncodeBig(bigint *big.Int) string

EncodeBig encodes bigint as a hex string with 0x prefix. The sign of the integer is ignored.

func EncodeToHex

func EncodeToHex(str []byte) string

EncodeToHex generates a hex string based on the byte representation, with the '0x' prefix

func EncodeToString

func EncodeToString(str []byte) string

EncodeToString is a wrapper method for hex.EncodeToString

func EncodeUint64

func EncodeUint64(i uint64) string

EncodeUint64 encodes a number as a hex string with 0x prefix.

func MustDecodeHex

func MustDecodeHex(str string) []byte

MustDecodeHex type-checks and converts a hex string to a byte array

Types

type DecError

type DecError struct {
	// contains filtered or unexported fields
}

func (DecError) Error

func (err DecError) Error() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL