Expand description
ECgFp5 elliptic curve and its scalar field, as used by the Lighter signer.
Pointis a curve point onECgFp5, with addition, doubling, scalar multiplication, and the canonicalFp5encode/decode pair.Scalaris the prime-order scalar field modulo the group ordern, with Montgomery-form multiplication and a signed-window recoding helper used by the variable-time scalar multiplication.
Both modules sit on top of the field layer and contain no unsafe. Vector
tests under test_data/ cross-check against the upstream Go reference.
Structs§
- Affine
Point - A point on the curve in affine
(x, u)coordinates. Used as window entries in scalar multiplication; the affine form skips theZandTdenominators. - Point
- A point on the ECgFp5 curve in fractional
(x, u) = (X/Z, U/T)coordinates. - Scalar
- A scalar in the ECgFp5 curve’s scalar field, stored in non-Montgomery form as five 64-bit little-endian limbs.
Constants§
- LIMBS
- Number of 64-bit limbs in a scalar.
- ORDER
- Group order
nof the ECgFp5 curve, a 319-bit prime. - SCALAR_
BYTES - Canonical 40-byte little-endian encoding length for a scalar.
Functions§
- batch_
to_ affine - Convert a slice of projective points to affine
(x, u)form using Montgomery’s trick: a singleFp5inversion services all entries. - lookup
- Window lookup: returns the affine point matching the signed digit
k. - lookup_
ct - Constant-time window lookup. Same semantics as
lookupbut every per-entry assignment and the finalunegation route throughFp5::ct_select, so neither the table walk nor the sign branch leaks the secret digit. Used byPoint::scalar_mul_ct. - lookup_
var_ time - Variable-time window lookup. Same semantics as
lookupbut with explicit short-circuit branches; only suitable for public-input scalar multiplication. - recode_
signed_ from_ limbs - Recode an arbitrary little-endian limb sequence into signed window digits. Standalone helper exposed mainly for testing parity with the upstream code.