Overview
Montgomery multiplication represents residues as xR mod n for a convenient radix R. Products can then be reduced with shifts and additions, which is useful for repeated modular exponentiation.
Multiplies numbers modulo n without trial division by working in Montgomery form.
Compact metadata for implementation and discovery.
Montgomery multiplication represents residues as xR mod n for a convenient radix R. Products can then be reduced with shifts and additions, which is useful for repeated modular exponentiation.
Quick facts
Runtime and memory behavior at a glance.
Best
O(k)
Average
O(k^2)
Worst
O(k^3)
Space
O(k)
Mont(a,b) = a*b*R^-1 mod nComputes a modular product in Montgomery representation.
Show working in Montgomery form to replace division with shifts and reductions on a small fast modular multiplication example.
Montgomery arithmetic pays off when setup is amortized across many products.
What each reference supports for this entry.
Cryptographic reference for Montgomery Multiplication's number-theoretic primitive, modular arithmetic, primality, or factorization context.
Open sourceReference for Montgomery Multiplication's arithmetic operations, modular arithmetic, multiplication, division, or number-theoretic implementation details.
Open sourceOriginal reference for modular multiplication without trial division.
Open sourceGood next jumps from the relationship graph, ranked for useful discovery.
Cryptography · Core
Barrett reduction and Montgomery reduction are different strategies for fast modular arithmetic.
Compare with thisMiller-Rabin performs many modular powers that can use Montgomery multiplication.
Barrett reduction and Montgomery reduction are different strategies for fast modular arithmetic.
Montgomery setup can use modular inverses for the radix and modulus.