BigintUtils class

Constructors

BigintUtils()

Properties

hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

adc(BigInt a, BigInt b, BigInt carry) → List<BigInt>
Add-with-carry: a + b + carry, returning sumLow, carryHigh.
bitlengthInBytes(BigInt value, {bool sign = false}) → int
Minimum number of bytes needed to represent value. Pass sign: true to reserve room for the sign bit (two's-complement encoding) — required for negative values, and also affects positive values whose top bit would otherwise be misread as a sign bit.
combineU256FromU64Parts(List<BigInt> parts, {Endian order = Endian.big}) → BigInt
Reassembles a 256-bit value from four 64-bit limbs (see splitU256ToU64Parts).
ctSelectBigInt(BigInt a, BigInt b, bool choice) → BigInt
Branchless select: returns b if choice else a.
divmod(BigInt value, int radix) → (BigInt, BigInt)
Divides value by radix, returning (quotient, remainder).
fromBytes(List<int> bytes, {int offset = 0, int? length, Endian byteOrder = Endian.big, bool sign = false}) → BigInt
Converts a list of bytes to a BigInt, considering byte order and sign.
fromBytes128(List<int> bytes, {int offset = 0, Endian byteOrder = Endian.big, bool sign = false}) → BigInt
fromBytes16(List<int> bytes, {int offset = 0, Endian byteOrder = Endian.big, bool sign = false}) → BigInt
fromBytes256(List<int> bytes, {int offset = 0, Endian byteOrder = Endian.big, bool sign = false}) → BigInt
fromBytes32(List<int> bytes, {int offset = 0, Endian byteOrder = Endian.big, bool sign = false}) → BigInt
fromBytes64(List<int> bytes, {int offset = 0, Endian byteOrder = Endian.big, bool sign = false}) → BigInt
fromBytes8(List<int> bytes, {int offset = 0, Endian byteOrder = Endian.big, bool sign = false}) → BigInt
inverseMod(BigInt a, BigInt m) → BigInt
Calculates the modular multiplicative inverse of a modulo m.
mac(BigInt a, BigInt b, BigInt c, BigInt carry) → List<BigInt>
Multiply-accumulate: a + b*c + carry, returning resultLow, resultHigh.
max(BigInt a, BigInt b) → BigInt
Returns the larger of a and b.
parse(dynamic number, {bool allowHex = true}) → BigInt
Parses a dynamic value number into a BigInt.
sbb(BigInt a, BigInt b, BigInt borrow) → List<BigInt>
Subtract-with-borrow: a - b - borrow, returning diffLow, diffHigh.
splitU256ToU64Parts(BigInt number, {Endian order = Endian.big}) → List<BigInt>
Splits a 256-bit unsigned number into four 64-bit limbs.
toBinary(BigInt value, {int zeroPadBitLen = 0}) → String
Converts a BigInt value to a binary string with optional zero padding.
toBinaryBool(BigInt value, {int? bitLength}) → List<bool>
Expands value into individual bits, LSB first.
toBytes(BigInt val, {int? length, Endian byteOrder = Endian.big, bool sign = false}) → BuBytes
Converts a BigInt to a byte list with the given length and byte order. Pass sign = true to encode negative values as two's complement.
tryParse(dynamic number, {bool allowHex = true}) → BigInt?
Tries to parse a dynamic value number into a BigInt, returning null if parsing fails.
variableNatDecode(List<int> bytes) → (BigInt, int)
Decodes a value encoded by variableNatEncode, returning (value, bytesRead).
variableNatEncode(BigInt val) → BuBytes
LEB128-style variable-length encoding of a non-negative val.