Documentation ¶
Index ¶
- Constants
- Variables
- func Fingerprint(slice []byte) []byte
- func GetInt64BE(src []byte) int64
- func GetInt64LE(src []byte) int64
- func GetUint64BE(src []byte) uint64
- func GetUint64LE(src []byte) uint64
- func Int64FromWord256(word Word256) int64
- func IsUint64SumOverflow(a, b uint64) bool
- func IsZeros(slice []byte) bool
- func LeftPadBytes(slice []byte, l int) []byte
- func PutInt64BE(dest []byte, i int64)
- func PutInt64LE(dest []byte, i int64)
- func PutUint64BE(dest []byte, i uint64)
- func PutUint64LE(dest []byte, i uint64)
- func RightPadBytes(slice []byte, l int) []byte
- func S256(x *big.Int) *big.Int
- func SignExtend(back uint64, x *big.Int) *big.Int
- func Tuple256Split(t Tuple256) (Word256, Word256)
- func U256(x *big.Int) *big.Int
- func Uint64FromWord256(word Word256) uint64
- type HexBytes
- func (hb HexBytes) Bytes() []byte
- func (hb HexBytes) Marshal() ([]byte, error)
- func (hb HexBytes) MarshalText() ([]byte, error)
- func (hb HexBytes) MarshalTo(data []byte) (int, error)
- func (hb HexBytes) Size() int
- func (hb HexBytes) String() string
- func (hb *HexBytes) Unmarshal(data []byte) error
- func (hb *HexBytes) UnmarshalText(hexBytes []byte) error
- type Tuple256
- type Tuple256Slice
- type Word160
- type Word256
- func (w Word256) Bytes() []byte
- func (w Word256) Compare(other Word256) int
- func (w Word256) Copy() Word256
- func (w Word256) IsZero() bool
- func (w *Word256) Marshal() ([]byte, error)
- func (w Word256) MarshalText() ([]byte, error)
- func (w *Word256) MarshalTo(data []byte) (int, error)
- func (w Word256) Postfix(n int) []byte
- func (w Word256) Prefix(n int) []byte
- func (w Word256) Size() int
- func (w Word256) String() string
- func (w *Word256) Unmarshal(data []byte) error
- func (w *Word256) UnmarshalText(hexBytes []byte) error
- func (w Word256) UnpadLeft() []byte
- func (w Word256) UnpadRight() []byte
- func (w Word256) Word160() (w160 Word160)
- type Words256
Constants ¶
View Source
const Word160Length = 20
View Source
const Word256Length = 32
View Source
const Word256Word160Delta = 12
Variables ¶
View Source
var ( Zero256 = Word256{} One256 = LeftPadWord256([]byte{1}) )
View Source
var Big256 = big.NewInt(256)
View Source
var BigWord256Length = big.NewInt(Word256Length)
View Source
var Zero160 = Word160{}
Functions ¶
func Fingerprint ¶
func GetInt64BE ¶
func GetInt64LE ¶
func GetUint64BE ¶
func GetUint64LE ¶
func Int64FromWord256 ¶
func IsUint64SumOverflow ¶
Returns whether a + b would be a uint64 overflow
func LeftPadBytes ¶
func PutInt64BE ¶
func PutInt64LE ¶
func PutUint64BE ¶
func PutUint64LE ¶
func RightPadBytes ¶
func SignExtend ¶
Treats the positive big int x as if it contains an embedded a back + 1 byte signed integer in its least significant bits and extends that sign
func Tuple256Split ¶
func U256 ¶
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 ¶
Types ¶
type HexBytes ¶ added in v0.19.0
type HexBytes []byte
func (HexBytes) MarshalText ¶ added in v0.19.0
func (*HexBytes) UnmarshalText ¶ added in v0.19.0
type Tuple256Slice ¶
type Tuple256Slice []Tuple256
func (Tuple256Slice) Len ¶
func (p Tuple256Slice) Len() int
func (Tuple256Slice) Less ¶
func (p Tuple256Slice) Less(i, j int) bool
func (Tuple256Slice) Sort ¶
func (p Tuple256Slice) Sort()
func (Tuple256Slice) Swap ¶
func (p Tuple256Slice) Swap(i, j int)
type Word160 ¶
type Word160 [Word160Length]byte
type Word256 ¶
type Word256 [Word256Length]byte
func Int64ToWord256 ¶
func LeftPadWord256 ¶
func RightPadWord256 ¶
func Uint64ToWord256 ¶
func (Word256) MarshalText ¶ added in v0.19.0
func (*Word256) UnmarshalText ¶ added in v0.19.0
func (Word256) UnpadRight ¶
Click to show internal directories.
Click to hide internal directories.