burrow: github.com/hyperledger/burrow/binary Index | Files

package binary

import "github.com/hyperledger/burrow/binary"

Index

Package Files

bytes.go byteslice.go integer.go word160.go word256.go

Constants

const Word160Length = 20
const Word256Bits = Word256Bytes * 8
const Word256Bytes = 32
const Word256Word160Delta = 12

Variables

var (
    Zero256 = Word256{}
    One256  = LeftPadWord256([]byte{1})
)
var Big256 = big.NewInt(256)
var BigWord256Bytes = big.NewInt(Word256Bytes)
var Zero160 = Word160{}

func BigIntFromWord256 Uses

func BigIntFromWord256(word Word256) *big.Int

func Fingerprint Uses

func Fingerprint(slice []byte) []byte

func FromTwosComplement Uses

func FromTwosComplement(x *big.Int, n uint) *big.Int

Interprets a positive big.Int as a n-bit two's complement signed integer

func Int64FromWord256 Uses

func Int64FromWord256(word Word256) int64

func IsUint64SumOverflow Uses

func IsUint64SumOverflow(a, b uint64) bool

Returns whether a + b would be a uint64 overflow

func IsZeros Uses

func IsZeros(slice []byte) bool

func LeftPadBytes Uses

func LeftPadBytes(slice []byte, l int) []byte

func RightPadBytes Uses

func RightPadBytes(slice []byte, l int) []byte

func S256 Uses

func S256(x *big.Int) *big.Int

Interprets a positive big.Int as a 256-bit two's complement signed integer

func SignExtend Uses

func SignExtend(x *big.Int, n uint) *big.Int

Treats the positive big int x as if it contains an embedded n bit signed integer in its least significant bits and extends that sign

func ToTwosComplement Uses

func ToTwosComplement(x *big.Int, n uint) *big.Int

Convert a possibly negative big.Int x to a positive big.Int encoded in two's complement

func Tuple256Split Uses

func Tuple256Split(t Tuple256) (Word256, Word256)

func U256 Uses

func U256(x *big.Int) *big.Int

Converts a possibly negative big int x into a positive big int encoding a twos complement representation of x truncated to 32 bytes

func Uint64FromWord256 Uses

func Uint64FromWord256(word Word256) uint64

type HexBytes Uses

type HexBytes []byte

func (HexBytes) Bytes Uses

func (hb HexBytes) Bytes() []byte

func (HexBytes) Marshal Uses

func (hb HexBytes) Marshal() ([]byte, error)

Protobuf support

func (HexBytes) MarshalText Uses

func (hb HexBytes) MarshalText() ([]byte, error)

func (HexBytes) MarshalTo Uses

func (hb HexBytes) MarshalTo(data []byte) (int, error)

func (HexBytes) Size Uses

func (hb HexBytes) Size() int

func (HexBytes) String Uses

func (hb HexBytes) String() string

func (*HexBytes) Unmarshal Uses

func (hb *HexBytes) Unmarshal(data []byte) error

func (*HexBytes) UnmarshalText Uses

func (hb *HexBytes) UnmarshalText(hexBytes []byte) error

type Tuple256 Uses

type Tuple256 struct {
    First  Word256
    Second Word256
}

func (Tuple256) Compare Uses

func (tuple Tuple256) Compare(other Tuple256) int

type Tuple256Slice Uses

type Tuple256Slice []Tuple256

func (Tuple256Slice) Len Uses

func (p Tuple256Slice) Len() int

func (Tuple256Slice) Less Uses

func (p Tuple256Slice) Less(i, j int) bool

func (Tuple256Slice) Sort Uses

func (p Tuple256Slice) Sort()

func (Tuple256Slice) Swap Uses

func (p Tuple256Slice) Swap(i, j int)

type Word160 Uses

type Word160 [Word160Length]byte

func (Word160) Bytes Uses

func (w Word160) Bytes() []byte

func (Word160) Word256 Uses

func (w Word160) Word256() (word256 Word256)

Pad a Word160 on the left and embed it in a Word256 (as it is for account addresses in EVM)

type Word256 Uses

type Word256 [Word256Bytes]byte

func BigIntToWord256 Uses

func BigIntToWord256(x *big.Int) Word256

func Int64ToWord256 Uses

func Int64ToWord256(i int64) Word256

func LeftPadWord256 Uses

func LeftPadWord256(bz []byte) (word Word256)

func RightPadWord256 Uses

func RightPadWord256(bz []byte) (word Word256)

func Uint64ToWord256 Uses

func Uint64ToWord256(i uint64) (word Word256)

func (Word256) Bytes Uses

func (w Word256) Bytes() []byte

func (Word256) Compare Uses

func (w Word256) Compare(other Word256) int

func (Word256) Copy Uses

func (w Word256) Copy() Word256

func (Word256) IsZero Uses

func (w Word256) IsZero() bool

func (*Word256) Marshal Uses

func (w *Word256) Marshal() ([]byte, error)

Gogo proto support

func (Word256) MarshalText Uses

func (w Word256) MarshalText() ([]byte, error)

func (*Word256) MarshalTo Uses

func (w *Word256) MarshalTo(data []byte) (int, error)

func (Word256) Postfix Uses

func (w Word256) Postfix(n int) []byte

func (Word256) Prefix Uses

func (w Word256) Prefix(n int) []byte

copied.

func (Word256) Size Uses

func (w Word256) Size() int

func (Word256) String Uses

func (w Word256) String() string

func (*Word256) Unmarshal Uses

func (w *Word256) Unmarshal(data []byte) error

func (*Word256) UnmarshalText Uses

func (w *Word256) UnmarshalText(hexBytes []byte) error

func (Word256) UnpadLeft Uses

func (w Word256) UnpadLeft() []byte

func (Word256) UnpadRight Uses

func (w Word256) UnpadRight() []byte

func (Word256) Word160 Uses

func (w Word256) Word160() (w160 Word160)

Get a Word160 embedded a Word256 and padded on the left (as it is for account addresses in EVM)

type Words256 Uses

type Words256 []Word256

func (Words256) Len Uses

func (ws Words256) Len() int

func (Words256) Less Uses

func (ws Words256) Less(i, j int) bool

func (Words256) Swap Uses

func (ws Words256) Swap(i, j int)

Package binary imports 7 packages (graph) and is imported by 97 packages. Updated 2019-10-10. Refresh now. Tools for package owners.