hexutil

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2024 License: MIT Imports: 3 Imported by: 9

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BigIntToHex

func BigIntToHex(x *big.Int) string

BigIntToHex returns the hex representation of the given big integer. The hex string is prefixed with "0x". Negative numbers are prefixed with "-0x".

func BytesToHex

func BytesToHex(b []byte) string

BytesToHex returns the hex representation of the given bytes. The hex string is always even-length and prefixed with "0x".

func Has0xPrefix added in v0.4.5

func Has0xPrefix(h string) bool

Has0xPrefix returns true if the given byte slice starts with "0x".

func HexToBigInt

func HexToBigInt(h string) (*big.Int, error)

HexToBigInt returns the big integer representation of the given hex string. The hex string may be prefixed with "0x".

func HexToBytes

func HexToBytes(h string) ([]byte, error)

HexToBytes returns the bytes representation of the given hex string. The number of hex digits must be even. The hex string may be prefixed with "0x".

func MustHexToBigInt

func MustHexToBigInt(h string) *big.Int

func MustHexToBytes

func MustHexToBytes(h string) []byte

Types

This section is empty.

Jump to

Keyboard shortcuts

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