Montgomery Wants Odd

Montgomery multiplication replaces the modulo instruction with shifts and masks. What does it require?

A

The modulus must be coprime to r=264r = 2^{64}, which for a power of two means it must be odd. Values live in ordinary form xx, and the reduction subtracts multiples of rr to clear the high bits and then discards them, so one division still runs per multiply.

B

The modulus must be coprime to r=264r = 2^{64}, which for a power of two means it must be odd. Values live in Montgomery form xˉ=xr mod n\bar{x} = x r \bmod n, and the reduction adds multiples of nn to clear the low bits and then discards them, so no division ever runs.

C

The modulus must be prime, which for a power of two means it must be odd. Values live in Montgomery form xˉ=xr mod n\bar{x} = x r \bmod n, and the reduction adds multiples of nn to clear the low bits and then discards them, so no division ever runs.

D

The modulus must be below 2312^{31}, so that the product of two residues fits one register. Values live in Montgomery form xˉ=xr mod n\bar{x} = x r \bmod n, and the reduction adds multiples of nn to clear the low bits and then discards them, so no division ever runs.