Module rsa_cortex_m4::arithmetic[βˆ’][src]

[βˆ’]

Modular arithmetic (for moduli that are either Convenient or word-sized powers-of-two).

For Modular, we use incompletely reduced representations internally (which can be implemented on a word-level), offering a complete reduction for external use (which needs to be implemented on a bit-level).

For Wrapping<Unsigned>, we implement operations "mod 232(D+E)\text{mod } 2^{32(D + E)}", that is, dropping all carries and borrows.

This case does indeed have practical use, for instance, to calculate 65537βˆ’1 mod (pβˆ’1)65537^{-1} \text{ mod }(p - 1) via Arazi's Lemma.

Structs

Modular

Modular integer, corresponds to the residue class "modulo modulus".

ModularField
ModularRing
Montgomery

Montgomery representation of [x]n:=x (mod n)[x]_{n} := x\text{ }(\text{mod }n), as [xβ‹…2βˆ’32L]n[x \cdot 2^{-32L}]_n.

PrimeModular
Wrapping

Intentionally-wrapped arithmetic.

Type Definitions

LongModular
ShortModular
ShortMontgomery