{"modulePath":"github.com/hyperledger/burrow","version":"v0.34.4","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package binary\n\n## Constants\n\n```go\nconst Word160Length = 20\n```\n\n```go\nconst Word256Bits = Word256Bytes * 8\n```\n\n```go\nconst Word256Bytes = 32\n```\n\n```go\nconst Word256Word160Delta = 12\n```\n\n## Variables\n\n```go\nvar (\n\tZero256 = Word256{}\n\tOne256  = LeftPadWord256([]byte{1})\n)\n```\n\n```go\nvar Big256 = big.NewInt(256)\n```\n\n```go\nvar BigWord256Bytes = big.NewInt(Word256Bytes)\n```\n\n```go\nvar Zero160 = Word160{}\n```\n\n## Functions\n\n```go\nfunc BigIntFromLittleEndianBytes(bs []byte) *big.Int\n```\nNote: this function destructively reverses its input slice - pass a copy if the original is used elsewhere\n\n```go\nfunc BigIntFromWord256(word Word256) *big.Int\n```\n\n```go\nfunc BigIntToLittleEndianBytes(x *big.Int) []byte\n```\n\n```go\nfunc Fingerprint(slice []byte) []byte\n```\n\n```go\nfunc FromTwosComplement(x *big.Int, n uint) *big.Int\n```\nInterprets a positive big.Int as a n-bit two's complement signed integer\n\n```go\nfunc Int64FromWord256(word Word256) int64\n```\n\n```go\nfunc IsUint64SumOverflow(a, b uint64) bool\n```\nReturns whether a + b would be a uint64 overflow\n\n```go\nfunc IsZeros(slice []byte) bool\n```\n\n```go\nfunc LeftPadBytes(slice []byte, l int) []byte\n```\n\n```go\nfunc RightPadBytes(slice []byte, l int) []byte\n```\n\n```go\nfunc S256(x *big.Int) *big.Int\n```\nInterprets a positive big.Int as a 256-bit two's complement signed integer\n\n```go\nfunc SignExtend(x *big.Int, n uint) *big.Int\n```\nTreats the positive big int x as if it contains an embedded n bit signed integer in its least significant bits and extends that sign\n\n```go\nfunc ToTwosComplement(x *big.Int, n uint) *big.Int\n```\nConvert a possibly negative big.Int x to a positive big.Int encoded in two's complement\n\n```go\nfunc Tuple256Split(t Tuple256) (Word256, Word256)\n```\n\n```go\nfunc U256(x *big.Int) *big.Int\n```\nConverts a possibly negative big int x into a positive big int encoding a twos complement representation of x truncated to 32 bytes\n\n```go\nfunc Uint64FromWord256(word Word256) uint64\n```\n\n## Types\n\n```go\ntype HexBytes []byte\n```\n\n```go\nfunc (hb HexBytes) Bytes() []byte\n```\n\n```go\nfunc (hb HexBytes) Marshal() ([]byte, error)\n```\nProtobuf support\n\n```go\nfunc (hb HexBytes) MarshalText() ([]byte, error)\n```\n\n```go\nfunc (hb HexBytes) MarshalTo(data []byte) (int, error)\n```\n\n```go\nfunc (hb HexBytes) Size() int\n```\n\n```go\nfunc (hb HexBytes) String() string\n```\n\n```go\nfunc (hb *HexBytes) Unmarshal(data []byte) error\n```\n\n```go\nfunc (hb *HexBytes) UnmarshalText(hexBytes []byte) error\n```\n\n```go\ntype Tuple256 struct {\n\tFirst  Word256\n\tSecond Word256\n}\n```\n\n```go\nfunc (tuple Tuple256) Compare(other Tuple256) int\n```\n\n```go\ntype Tuple256Slice []Tuple256\n```\n\n```go\nfunc (p Tuple256Slice) Len() int\n```\n\n```go\nfunc (p Tuple256Slice) Less(i, j int) bool\n```\n\n```go\nfunc (p Tuple256Slice) Sort()\n```\n\n```go\nfunc (p Tuple256Slice) Swap(i, j int)\n```\n\n```go\ntype Word160 [Word160Length]byte\n```\n\n```go\nfunc (w Word160) Bytes() []byte\n```\n\n```go\nfunc (w Word160) Word256() (word256 Word256)\n```\nPad a Word160 on the left and embed it in a Word256 (as it is for account addresses in EVM)\n\n```go\ntype Word256 [Word256Bytes]byte\n```\n\n```go\nfunc BigIntToWord256(x *big.Int) Word256\n```\n\n```go\nfunc Int64ToWord256(i int64) Word256\n```\n\n```go\nfunc LeftPadWord256(bz []byte) (word Word256)\n```\n\n```go\nfunc RightPadWord256(bz []byte) (word Word256)\n```\n\n```go\nfunc Uint64ToWord256(i uint64) (word Word256)\n```\n\n```go\nfunc (w Word256) Bytes() []byte\n```\n\n```go\nfunc (w Word256) Compare(other Word256) int\n```\n\n```go\nfunc (w Word256) Copy() Word256\n```\n\n```go\nfunc (w Word256) IsZero() bool\n```\n\n```go\nfunc (w *Word256) Marshal() ([]byte, error)\n```\nGogo proto support\n\n```go\nfunc (w Word256) MarshalText() ([]byte, error)\n```\n\n```go\nfunc (w *Word256) MarshalTo(data []byte) (int, error)\n```\n\n```go\nfunc (w Word256) Postfix(n int) []byte\n```\n\n```go\nfunc (w Word256) Prefix(n int) []byte\n```\ncopied.\n\n```go\nfunc (w Word256) Size() int\n```\n\n```go\nfunc (w Word256) String() string\n```\n\n```go\nfunc (w *Word256) Unmarshal(data []byte) error\n```\n\n```go\nfunc (w *Word256) UnmarshalText(hexBytes []byte) error\n```\n\n```go\nfunc (w Word256) UnpadLeft() []byte\n```\n\n```go\nfunc (w Word256) UnpadRight() []byte\n```\n\n```go\nfunc (w Word256) Word160() (w160 Word160)\n```\nGet a Word160 embedded a Word256 and padded on the left (as it is for account addresses in EVM)\n\n```go\ntype Words256 []Word256\n```\n\n```go\nfunc (ws Words256) Len() int\n```\n\n```go\nfunc (ws Words256) Less(i, j int) bool\n```\n\n```go\nfunc (ws Words256) Swap(i, j int)\n```\n\n","path":"github.com/hyperledger/burrow/binary","name":"binary","synopsis":"","isRedistributable":true}
