Documentation ¶
Index ¶
- Variables
- func DecodeBig(input string) (*big.Int, error)
- func EncodeBig(bigint *big.Int) string
- func HexEncode(b []byte) string
- func MustDecodeBig(input string) *big.Int
- type BigInt
- func (z *BigInt) DecodeMsg(dc *msgp.Reader) (err error)
- func (z BigInt) EncodeMsg(en *msgp.Writer) (err error)
- func (self *BigInt) ExtensionType() int8
- func (self BigInt) Get() big.Int
- func (self *BigInt) Len() int
- func (self *BigInt) MarshalBinaryTo(b []byte) error
- func (z BigInt) MarshalMsg(b []byte) (o []byte, err error)
- func (self BigInt) MarshalText() ([]byte, error)
- func (z BigInt) Msgsize() (s int)
- func (self *BigInt) Put(in big.Int) *BigInt
- func (self *BigInt) String() string
- func (self *BigInt) ToInt() *big.Int
- func (self *BigInt) UnmarshalBinary(b []byte) error
- func (self *BigInt) UnmarshalJSON(input []byte) error
- func (z *BigInt) UnmarshalMsg(bts []byte) (o []byte, err error)
- func (self *BigInt) UnmarshalText(input []byte) error
- type Byte32
- func (z *Byte32) DecodeMsg(dc *msgp.Reader) (err error)
- func (z *Byte32) EncodeMsg(en *msgp.Writer) (err error)
- func (self Byte32) Format(s fmt.State, c rune)
- func (z *Byte32) MarshalMsg(b []byte) (o []byte, err error)
- func (self Byte32) MarshalText() ([]byte, error)
- func (z *Byte32) Msgsize() (s int)
- func (self Byte32) String() string
- func (self Byte32) UnmarshalJSON(input []byte) error
- func (z *Byte32) UnmarshalMsg(bts []byte) (o []byte, err error)
- func (self Byte32) UnmarshalText(input []byte) error
- type Byte64
- func (z *Byte64) DecodeMsg(dc *msgp.Reader) (err error)
- func (z *Byte64) EncodeMsg(en *msgp.Writer) (err error)
- func (self Byte64) Format(s fmt.State, c rune)
- func (z *Byte64) MarshalMsg(b []byte) (o []byte, err error)
- func (self Byte64) MarshalText() ([]byte, error)
- func (z *Byte64) Msgsize() (s int)
- func (self Byte64) String() string
- func (self Byte64) UnmarshalJSON(input []byte) error
- func (z *Byte64) UnmarshalMsg(bts []byte) (o []byte, err error)
- func (self Byte64) UnmarshalText(input []byte) error
- type Bytes
- func (z *Bytes) DecodeMsg(dc *msgp.Reader) (err error)
- func (z Bytes) EncodeMsg(en *msgp.Writer) (err error)
- func (self Bytes) Format(s fmt.State, c rune)
- func (z Bytes) MarshalMsg(b []byte) (o []byte, err error)
- func (self Bytes) MarshalText() ([]byte, error)
- func (z Bytes) Msgsize() (s int)
- func (self Bytes) String() string
- func (self Bytes) UnmarshalJSON(input []byte) error
- func (z *Bytes) UnmarshalMsg(bts []byte) (o []byte, err error)
- func (self Bytes) UnmarshalText(input []byte) error
Constants ¶
This section is empty.
Variables ¶
var ( ErrEmptyString = &decError{"empty hex string"} ErrSyntax = &decError{"invalid hex string"} ErrMissingPrefix = &decError{"hex string without 0x prefix"} ErrOddLength = &decError{"hex string of odd length"} ErrEmptyNumber = &decError{"hex string \"0x\""} ErrLeadingZero = &decError{"hex number with leading zero digits"} ErrUint64Range = &decError{"hex number > 64 bits"} ErrUintRange = &decError{fmt.Sprintf("hex number > %d bits", uintBits)} ErrBig256Range = &decError{"hex number > 256 bits"} )
Functions ¶
func DecodeBig ¶
DecodeBig decodes a hex string with 0x prefix as a quantity. Numbers larger than 256 bits are not accepted.
func EncodeBig ¶
EncodeBig encodes bigint as a hex string with 0x prefix. The sign of the integer is ignored.
func MustDecodeBig ¶
MustDecodeBig decodes a hex string with 0x prefix as a quantity. It panics for invalid input.
Types ¶
type BigInt ¶
func (*BigInt) ExtensionType ¶
Here, we'll pick an arbitrary number between 0 and 127 that isn't already in use
func (*BigInt) MarshalBinaryTo ¶
func (BigInt) MarshalMsg ¶
MarshalMsg implements msgp.Marshaler
func (BigInt) MarshalText ¶
MarshalText implements encoding.TextMarshaler
func (BigInt) Msgsize ¶
Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (*BigInt) UnmarshalBinary ¶
func (*BigInt) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler.
func (*BigInt) UnmarshalMsg ¶
UnmarshalMsg implements msgp.Unmarshaler
func (*BigInt) UnmarshalText ¶
UnmarshalText implements encoding.TextUnmarshaler
type Byte32 ¶
type Byte32 [32]byte
func (*Byte32) MarshalMsg ¶
MarshalMsg implements msgp.Marshaler
func (Byte32) MarshalText ¶
MarshalText implements encoding.TextMarshaler
func (*Byte32) Msgsize ¶
Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (Byte32) UnmarshalJSON ¶
UnmarshalJSON parses a Byte32 in hex syntax.
func (*Byte32) UnmarshalMsg ¶
UnmarshalMsg implements msgp.Unmarshaler
func (Byte32) UnmarshalText ¶
UnmarshalText parses a Byte32 in hex syntax.
type Byte64 ¶
type Byte64 [64]byte
func (*Byte64) MarshalMsg ¶
MarshalMsg implements msgp.Marshaler
func (Byte64) MarshalText ¶
MarshalText implements encoding.TextMarshaler
func (*Byte64) Msgsize ¶
Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (Byte64) UnmarshalJSON ¶
UnmarshalJSON parses a Byte64 in hex syntax.
func (*Byte64) UnmarshalMsg ¶
UnmarshalMsg implements msgp.Unmarshaler
func (Byte64) UnmarshalText ¶
UnmarshalText parses a Byte64 in hex syntax.
type Bytes ¶
type Bytes []byte
func (Bytes) MarshalMsg ¶
MarshalMsg implements msgp.Marshaler
func (Bytes) MarshalText ¶
MarshalText implements encoding.TextMarshaler
func (Bytes) Msgsize ¶
Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (Bytes) UnmarshalJSON ¶
UnmarshalJSON parses a Byte64 in hex syntax.
func (*Bytes) UnmarshalMsg ¶
UnmarshalMsg implements msgp.Unmarshaler
func (Bytes) UnmarshalText ¶
UnmarshalText parses a Byte64 in hex syntax.