Element class

Constructors

Element(BigInt l0, BigInt l1, BigInt l2, BigInt l3, BigInt l4)
Element.feOne()
factory
Element.feZero()
factory
Element.fromInt(int l0, int l1, int l2, int l3, int l4)
factory
Element.sqrtM1()
sqrtM1 is 2^((p-1)/4), which squared is equal to -1 by Euler's Criterion.
factory

Properties

hashCode int
The hash code for this object.
no setteroverride
l0 BigInt
An element t represents the integer t.l0 + t.l12^51 + t.l22^102 + t.l32^153 + t.l42^204
getter/setter pair
l1 BigInt
getter/setter pair
l2 BigInt
getter/setter pair
l3 BigInt
getter/setter pair
l4 BigInt
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

absolute(Element u) → void
Absolute sets v to |u|, and returns v.
add(Element a, Element b) → void
Add sets v = a + b, and returns v.
Bytes() List<int>
Bytes returns the canonical 32-byte little-endian encoding of v.
carryPropagateGeneric() → void
carryPropagate brings the limbs below 52 bits by applying the reduction identity (a * 2²⁵⁵ + b = a * 19 + b) to the l4 carry.
equal(Element u) int
Equal returns 1 if v and u are equal, and 0 otherwise.
feMulGeneric(Element a, Element b) → void
Limb multiplication works like pen-and-paper columnar multiplication, but with 51-bit limbs instead of digits.
feSquareGeneric(Element a) → void
Squaring works precisely like multiplication above, but thanks to its symmetry we get to group a few terms together.
fromBigInt(BigInt n) → void
fromBig sets v = n, and returns v. The bit length of n must not exceed 256.
fromDecimal(String s) → void
invert(Element z) → void
Invert sets v = 1/z mod p, and returns v.
isNegative() int
IsNegative returns 1 if v is negative, and 0 otherwise.
mask64Bits(int cond) BigInt
mask64Bits returns 0xffffffff if cond is 1, and 0 otherwise.
mul51(BigInt a, int b) → (BigInt, BigInt)
mul51 returns lo + hi * 2⁵¹ = a * b.
mult32(Element x, int y) → void
Mult32 sets v = x * y, and returns v.
multiply(Element x, Element y) → void
Multiply sets v = x * y, and returns v.
negate(Element a) → void
Negate sets v = -a, and returns v.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
one() → void
One sets v = 1, and returns v.
pow22523(Element x) → void
Pow22523 set v = x^((p-5)/8), and returns v. (p-5)/8 is 2^252-3.
reduce() → void
reduce reduces v modulo 2^255 - 19 and returns it.
select(Element a, Element b, int cond) → void
Select sets v to a if cond == 1, and to b if cond == 0.
set(Element a) → void
Set sets v = a, and returns v.
setBytes(Uint8List x) → void
SetBytes sets v to x, where x is a 32-byte little-endian encoding. If x is not of the right length, SetBytes returns nil and an error, and the receiver is unchanged.
setWideBytes(Uint8List x) → void
This file contains additional functionality that is not included in the upstream crypto/ed25519/edwards25519/field package.
sqrtRatio(Element u, Element v) → (Element, int)
SqrtRatio sets r to the non-negative square root of the ratio of u and v.
square(Element x) → void
Square sets v = x * x, and returns v.
subtract(Element a, Element b) → void
Subtract sets v = a - b, and returns v.
swap(Element u, int cond) → void
Swap swaps v and u if cond == 1 or leaves them unchanged if cond == 0, and returns v.
toBigInt() BigInt
converts the field element to a big integer.
toString() String
A string representation of this object.
override
zero() → void
Zero sets v = 0, and returns v.

Operators

operator ==(Object other) bool
The equality operator.
override