Search code examples
encryptioncryptographyrsamodulo

RSA Algorithm 1 Mod Phi = 1?


On this website it states for the calculation of "d" you must use the formula e.d = 1 Mod Phi.
I don't quite understand as I believed 1 Mod anything will result in 1 (or 0 in case 1 Mod 1).
This simplifies the formula to e.d = 1 which clearly is not correct with the given test values :
e = 17 , Phi = 3120 , d = 2753.

I would appreciate some clarification on how the RSA calculates the decryption key.


Solution

  • Wikipedia says this is a Modular multiplicative inverse. The formula should be read as e * d equals 1, when the result is expressed modulo Phi, or (e*d) % Phi == 1 in pseudocode.