hex

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2025 License: MIT Imports: 5 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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