Documentation ¶
Overview ¶
A library for 160 and 256 bit integers for use with EC keys, signatures and RIPEMD160, as well as very basic arithmetic functions built from big.Int
Index ¶
- Constants
- type U160
- func (u *U160) Add(operand *U160) *U160
- func (u *U160) And(operand *U160) *U160
- func (u *U160) Assign(input *U160) *U160
- func (u *U160) EQ(operand *U160) bool
- func (u *U160) FromBytes(input []byte) *U160
- func (u *U160) FromString(input string) *U160
- func (u *U160) FromUint64(input uint64) *U160
- func (u *U160) GT(operand *U160) bool
- func (u *U160) GToE(operand *U160) bool
- func (u *U160) LT(operand *U160) bool
- func (u *U160) LToE(operand *U160) bool
- func (u *U160) NEQ(operand *U160) bool
- func (u *U160) Not() *U160
- func (u *U160) Or(operand *U160) *U160
- func (u *U160) Sub(operand *U160) *U160
- func (u *U160) ToBytes() []byte
- func (u *U160) ToString() string
- func (u *U160) Xor(operand *U160) *U160
- type U256
- func (u *U256) Add(operand *U256) *U256
- func (u *U256) And(operand *U256) *U256
- func (u *U256) Assign(input *U256) *U256
- func (u *U256) EQ(operand *U256) bool
- func (u *U256) FromBytes(input []byte) *U256
- func (u *U256) FromString(input string) *U256
- func (u *U256) FromUint64(input uint64) *U256
- func (u *U256) GT(operand *U256) bool
- func (u *U256) GToE(operand *U256) bool
- func (u *U256) LT(operand *U256) bool
- func (u *U256) LToE(operand *U256) bool
- func (u *U256) NEQ(operand *U256) bool
- func (u *U256) Not() *U256
- func (u *U256) Or(operand *U256) *U256
- func (u *U256) Sub(operand *U256) *U256
- func (u *U256) ToBytes() []byte
- func (u *U256) ToString() string
- func (u *U256) Xor(operand *U256) *U256
Constants ¶
const ( // Bitwidth160 is the number of bits in a U160 Bitwidth160 = 160 // Bytewidth160 is the number of bytes in a U160 Bytewidth160 = 20 )
const ( // Bitwidth256 is the number of bits in a U256 Bitwidth256 = 256 // Bytewidth256 is the number of bytes in a U256 Bytewidth256 = 32 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type U160 ¶
U160 stores the 160 bit integer value in a big.Int
func (*U160) FromString ¶
Converts a string, attempting to autodetect base, into a U256, truncates if the number is too large for 160 bits
func (*U160) FromUint64 ¶
Puts a Uint64 value into the U256 and returns a U160
func (*U160) GToE ¶
Returns true if the operand is greater than or equal to the value in the receiver
func (*U160) Sub ¶
Returns the difference of the value in the receiver and the operand and stores it
type U256 ¶
U256 stores a 256 bit value in a big.Int
func (*U256) And ¶
Performs a logical AND between one U256 and another and stores the value in the receiver
func (*U256) FromBytes ¶
Converts a byte slice to U256, truncating or padding as required, storing in the receiver, and returning the derived value
func (*U256) FromString ¶
FromString converts a string, detecting hexadecimal or octal prefix as required and converting to U256 and returning to the caller
func (*U256) FromUint64 ¶
Converts a uint64 to U256, stores it and returns it
func (*U256) GToE ¶
Returns true if the operand is greater than or equal to the value in the receiver
func (*U256) Or ¶
Returns the logical OR between one 256 bit value and another and stores the result in the receiver