fe25519.bend checks
raw source on the hub · import element-crypto@0.1.0.0/fe25519.bend as Fe25519
1 import
import Base
Types
type Fe source · line 7 · 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 -> Fe
Definitions
def carry source · line 12 · raw
@x:Fe -> Fe
Limbs below about 2^31 back to 13 bits; the carry out of limb 19 (weight 2^260) comes back into limb 0 times 608.
def add source · line 59 · raw
@a:Fe -> @b:Fe -> Fe
def sub source · line 68 · raw
@a:Fe -> @b:Fe -> Fe
a - b as a + 128p - b: every limb of the 128p used here is at least 2^14, more than a carried limb, so no limb goes below zero.
def mul source · line 75 · raw
@a:Fe -> @b:Fe -> Fe
def sq source · line 179 · raw
@a:Fe -> Fe
def mul_small source · line 302 · raw
@a:Fe -> @+k:U32 -> Fe
a * k for a small k (121665, the curve's (A - 2) / 4): limbs below 2^30.
def cswap source · line 308 · raw
@+s:U32 -> @a:Fe -> @b:Fe -> Pair(Fe, Fe)
Swap a and b when s is 1, keep them when s is 0, with no branch: a mask.
def zero source · line 336 · raw
Fe
def one source · line 339 · raw
Fe
def strict source · line 346 · raw
@x:Fe -> Fe
The canonical value in [0, p), in four strict passes: limbs below 2^13 with the carry out of limb 19 folded back (twice: the second fold carries nothing), then bits 255..259 folded as 19 each, then p subtracted by a mask when the value is still >= p.
def fold255 source · line 391 · raw
@x:Fe -> Fe
def freeze_go source · line 396 · raw
@x:Fe -> Fe
def freeze source · line 443 · raw
@x:Fe -> Fe
def or0 source · line 446 · raw
@m:Maybe<&2, U32> -> U32
def byte_at source · line 453 · raw
@xs:List<&2, U32> -> @+n:Nat -> U32
def of_bytes source · line 456 · raw
@+bs:List<&2, U32> -> Fe
def canon_bytes source · line 512 · raw
@x:Fe -> List<&2, U32>
def to_bytes source · line 549 · raw
@x:Fe -> List<&2, U32>
def pow_step source · line 552 · raw
@b:Bool -> @+x:Fe -> @a:Fe -> Fe
def pow_go source · line 559 · raw
@+x:Fe -> @bits:List<&2, Bool> -> @acc:Fe -> Fe
def inv_bits source · line 567 · raw
List<&2, Bool>
The bits of p - 2, top first (a public exponent: branching on it leaks nothing).
def inv source · line 570 · raw
@+x:Fe -> Fe