hex

package
v0.0.0-...-8f649d9 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2020 License: LGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const BadNibble = ^uint64(0)

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"}
)

Functions

func DecodeHex

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

func DecodeNibble

func DecodeNibble(in byte) uint64

func DecodeString

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

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

func EncodeToString

func EncodeToString(str []byte) string

func EncodeUint64

func EncodeUint64(i uint64) string

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

func MustDecodeHex

func MustDecodeHex(str string) []byte

func MustDecodeString

func MustDecodeString(str string) []byte

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