util

package
v0.95.3 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2021 License: MIT Imports: 6 Imported by: 140

Documentation

Index

Constants

View Source
const Uint160Size = 20

Uint160Size is the size of Uint160 in bytes.

View Source
const Uint256Size = 32

Uint256Size is the size of Uint256 in bytes.

Variables

This section is empty.

Functions

func ArrayReverse

func ArrayReverse(b []byte) []byte

ArrayReverse returns a reversed version of the given byte slice.

Types

type Uint160

type Uint160 [Uint160Size]uint8

Uint160 is a 20 byte long unsigned integer.

func Uint160DecodeBytesBE

func Uint160DecodeBytesBE(b []byte) (u Uint160, err error)

Uint160DecodeBytesBE attempts to decode the given bytes into an Uint160.

func Uint160DecodeBytesLE

func Uint160DecodeBytesLE(b []byte) (u Uint160, err error)

Uint160DecodeBytesLE attempts to decode the given bytes in little-endian into an Uint160.

func Uint160DecodeStringBE

func Uint160DecodeStringBE(s string) (Uint160, error)

Uint160DecodeStringBE attempts to decode the given string into an Uint160.

func Uint160DecodeStringLE

func Uint160DecodeStringLE(s string) (Uint160, error)

Uint160DecodeStringLE attempts to decode the given string in little-endian hex encoding into an Uint160.

func (Uint160) BytesBE

func (u Uint160) BytesBE() []byte

BytesBE returns a big-endian byte representation of u.

func (Uint160) BytesLE

func (u Uint160) BytesLE() []byte

BytesLE returns a little-endian byte representation of u.

func (*Uint160) DecodeBinary added in v0.90.0

func (u *Uint160) DecodeBinary(br *io.BinReader)

DecodeBinary implements Serializable interface.

func (*Uint160) EncodeBinary added in v0.90.0

func (u *Uint160) EncodeBinary(bw *io.BinWriter)

EncodeBinary implements Serializable interface.

func (Uint160) Equals

func (u Uint160) Equals(other Uint160) bool

Equals returns true if both Uint160 values are the same.

func (Uint160) Less

func (u Uint160) Less(other Uint160) bool

Less returns true if this value is less than given Uint160 value. It's primarily intended to be used for sorting purposes.

func (Uint160) MarshalJSON

func (u Uint160) MarshalJSON() ([]byte, error)

MarshalJSON implements the json marshaller interface.

func (Uint160) Reverse

func (u Uint160) Reverse() (r Uint160)

Reverse returns reversed representation of u.

func (Uint160) String

func (u Uint160) String() string

String implements the stringer interface.

func (Uint160) StringBE

func (u Uint160) StringBE() string

StringBE returns string representations of u with big-endian byte order.

func (Uint160) StringLE

func (u Uint160) StringLE() string

StringLE returns string representations of u with little-endian byte order.

func (*Uint160) UnmarshalJSON

func (u *Uint160) UnmarshalJSON(data []byte) (err error)

UnmarshalJSON implements the json unmarshaller interface.

type Uint256

type Uint256 [Uint256Size]uint8

Uint256 is a 32 byte long unsigned integer.

func Uint256DecodeBytesBE

func Uint256DecodeBytesBE(b []byte) (u Uint256, err error)

Uint256DecodeBytesBE attempts to decode the given string (in BE representation) into an Uint256.

func Uint256DecodeBytesLE

func Uint256DecodeBytesLE(b []byte) (u Uint256, err error)

Uint256DecodeBytesLE attempts to decode the given string (in LE representation) into an Uint256.

func Uint256DecodeStringBE

func Uint256DecodeStringBE(s string) (u Uint256, err error)

Uint256DecodeStringBE attempts to decode the given string (in BE representation) into an Uint256.

func Uint256DecodeStringLE

func Uint256DecodeStringLE(s string) (u Uint256, err error)

Uint256DecodeStringLE attempts to decode the given string (in LE representation) into an Uint256.

func (Uint256) BytesBE

func (u Uint256) BytesBE() []byte

BytesBE returns a byte slice representation of u.

func (Uint256) BytesLE

func (u Uint256) BytesLE() []byte

BytesLE return a little-endian byte representation of u.

func (Uint256) CompareTo

func (u Uint256) CompareTo(other Uint256) int

CompareTo compares two Uint256 with each other. Possible output: 1, -1, 0

1 implies u > other.

-1 implies u < other.

0 implies  u = other.

func (*Uint256) DecodeBinary

func (u *Uint256) DecodeBinary(r *io.BinReader)

DecodeBinary implements io.Serializable interface.

func (*Uint256) EncodeBinary

func (u *Uint256) EncodeBinary(w *io.BinWriter)

EncodeBinary implements io.Serializable interface.

func (Uint256) Equals

func (u Uint256) Equals(other Uint256) bool

Equals returns true if both Uint256 values are the same.

func (Uint256) MarshalJSON

func (u Uint256) MarshalJSON() ([]byte, error)

MarshalJSON implements the json marshaller interface.

func (Uint256) Reverse

func (u Uint256) Reverse() Uint256

Reverse reverses the Uint256 object.

func (Uint256) String

func (u Uint256) String() string

String implements the stringer interface.

func (Uint256) StringBE

func (u Uint256) StringBE() string

StringBE produces string representation of Uint256 with BE byte order.

func (Uint256) StringLE

func (u Uint256) StringLE() string

StringLE produces string representation of Uint256 with LE byte order.

func (*Uint256) UnmarshalJSON

func (u *Uint256) UnmarshalJSON(data []byte) (err error)

UnmarshalJSON implements the json unmarshaller interface.

Directories

Path Synopsis
Package bitfield provides a simple and efficient arbitrary size bit field implementation.
Package bitfield provides a simple and efficient arbitrary size bit field implementation.

Jump to

Keyboard shortcuts

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