Expand description
Montgomery form conversion for field elements.
The hardware operates in Montgomery domain with R = 2^128.
This module provides conversion between standard and Montgomery
representations.
In Montgomery form, an element a is represented as aR mod p.
Montgomery multiplication: MontMul(aR, bR) = abR mod p.
This reference implementation stores the standard value
internally and performs standard arithmetic for correctness.
The Montgomery representation is available via MontgomeryElement::to_mont_repr
for comparison with hardware outputs.
Structs§
- Montgomery
Element - A field element that tracks both standard and Montgomery forms.
Constants§
- MONT_
BITS 🔒 - Number of bits in the Montgomery constant R.
Functions§
- halve_
mod_ 🔒p - Halves a field element modulo p.