fen384.bend checks
raw source on the hub · import element-crypto@0.1.0.0/fen384.bend as Fen384
1 import
import Base
Types
type Fe source · line 11 · raw
Data
Fe@l0:U32 -> @l1:U32 -> @l2:U32 -> @l3:U32 -> @l4:U32 -> @l5:U32 -> @l6:U32 -> @l7:U32 -> @l8:U32 -> @l9:U32 -> @l10:U32 -> @l11:U32 -> @l12:U32 -> @l13:U32 -> @l14:U32 -> @l15:U32 -> @l16:U32 -> @l17:U32 -> @l18:U32 -> @l19:U32 -> @l20:U32 -> @l21:U32 -> @l22:U32 -> @l23:U32 -> @l24:U32 -> @l25:U32 -> @l26:U32 -> @l27:U32 -> @l28:U32 -> @l29:U32 -> Fe
Definitions
def zero source · line 14 · raw
Fe
def one source · line 18 · raw
Fe
1 in Montgomery form: R mod p.
def r2 source · line 22 · raw
Fe
R^2 mod p, which to_mont multiplies by.
def unit source · line 26 · raw
Fe
The plain integer 1 (from_mont multiplies by it).
def less_2p source · line 30 · raw
@x:Fe -> Fe
x below 4p back below 2p: 2p subtracted by a mask (no branch on a limb).
def canon source · line 97 · raw
@x:Fe -> Fe
x below 2p to its canonical value in [0, p): p subtracted by a mask.
def is_reduced source · line 164 · raw
@x:Fe -> Bool
x below p (x from bytes: limbs below 2^13): the borrow of x - p.
def add source · line 229 · raw
@a:Fe -> @b:Fe -> Fe
def sub source · line 297 · raw
@a:Fe -> @b:Fe -> Fe
a - b: a borrow chain, then 2p added by a mask when it borrowed (a - b + 2p is in (0, 2p) then); the carry out of the top limb is the R the borrow lent.
def mul source · line 425 · raw
@a:Fe -> @b:Fe -> Fe
a b R^-1 mod p, below 2p.
def sq source · line 581 · raw
@a:Fe -> Fe
a a R^-1 mod p, below 2p: each cross product once, against 2 a_j.
def select source · line 765 · raw
@+s:U32 -> @a:Fe -> @b:Fe -> Fe
Swap-free select: a when s is 0, b when s is 1 (a mask, no branch).
def or_limbs source · line 773 · raw
@x:Fe -> U32
def is_zero source · line 778 · raw
@+x:Fe -> Bool
def eq source · line 781 · raw
@+a:Fe -> @+b:Fe -> Bool
def to_mont source · line 784 · raw
@+x:Fe -> Fe
def from_mont source · line 788 · raw
@+x:Fe -> Fe
Out of Montgomery form, canonical.
def or0 source · line 791 · raw
@m:Maybe<&2, U32> -> U32
def byte_at source · line 798 · raw
@xs:List<&2, U32> -> @+n:Nat -> U32
def of_bytes source · line 803 · raw
@+bs:List<&2, U32> -> Fe
The plain value of big-endian bytes; only the last 48 count (callers check the length), so the value is below 2^384. Not reduced: see is_reduced.
def canon_bytes source · line 886 · raw
@x:Fe -> List<&2, U32>
A canonical plain value as 48 big-endian bytes.
def to_bytes source · line 940 · raw
@+x:Fe -> List<&2, U32>
A Montgomery-form value as its canonical big-endian bytes.
def pow_step source · line 943 · raw
@b:Bool -> @+x:Fe -> @a:Fe -> Fe
def pow_go source · line 950 · raw
@+x:Fe -> @bits:List<&2, Bool> -> @acc:Fe -> Fe
def inv_bits source · line 958 · raw
List<&2, Bool>
The bits of p - 2, top first (a public exponent: branching on it leaks nothing).
def inv source · line 962 · raw
@+x:Fe -> Fe
x^-1 = x^(p-2) (Fermat), in Montgomery form; 0 for 0.