bnutil

package
v0.0.0-...-f5f0bdb Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2019 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromHex

func FromHex(hexStr string) (*big.Int, error)

FromHex creates a math/big big number from a hex string.

func ToBN

func ToBN(ivalue interface{}, isLittleEndian bool) *big.Int

ToBN creates a BN value from a number input

func ToHex

func ToHex(value *big.Int, bitLength int, isNegative bool) string

ToHex creates a hex value from a math/big big number. 0 inputs returns a `0x` result, BN values return the actual value as a `0x` prefixed hex value. With `bitLength` set, it fixes the number to the specified length.

func ToUint8Slice

func ToUint8Slice(value *big.Int, bitLength int, isLittleEndian bool, isNegative bool) []uint8

ToUint8Slice creates a uint8 array from a big number. Empty input returns an empty uint8 array result. Convert using little-endian format if `isLittleEndian` is set.

Types

type Uint8Slice

type Uint8Slice []uint8

Uint8Slice ... Example: sort.Sort(sort.Reverse(Uint8Slice(output)))

func (Uint8Slice) Len

func (s Uint8Slice) Len() int

Len ...

func (Uint8Slice) Less

func (s Uint8Slice) Less(i, j int) bool

Less ...

func (Uint8Slice) Swap

func (s Uint8Slice) Swap(i, j int)

Swap ...

Jump to

Keyboard shortcuts

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