Here are further words from Wikipedia, to learn against later. [1]https://en.m.wikipedia.org/wiki/RSA_(cryptosystem) In the original RSA paper,^[2][2] the [3]Euler totient function φ(n) = (p − 1)(q − 1) is used instead of λ(n) for calculating the private exponent d. Since φ(n) is always divisible by λ(n) the algorithm works as well. That the [4]Euler totient function can be used can also be seen as a consequence of [5]Lagrange's theorem applied to the [6]multiplicative group of integers modulo pq. Thus any d satisfying d⋅e ≡ 1 (mod φ(n)) also satisfies d⋅e ≡ 1 (mod λ(n)). However, computing d modulo φ(n) will sometimes yield a result that is larger than necessary (i.e. d > λ(n)). Most of the implementations of RSA will accept exponents generated using either method (if they use the private exponent d at all, rather than using the optimized decryption method [7]based on the Chinese remainder theorem described below), but some standards such as [8]FIPS 186-4 may require that d < λ(n). Any "oversized" private exponents not meeting that criterion may always be reduced modulo λ(n) to obtain a smaller equivalent exponent. Since any common factors of (p − 1) and (q − 1) are present in the factorisation of n − 1 = pq − 1 = (p − 1)(q − 1) + (p − 1) + (q − 1),^[9][17] it is recommended that (p − 1) and (q − 1) have only very small common factors, if any besides the necessary 2.^[10][2]^[11][18]^[12][19]^[13][20] Note: The authors of the original RSA paper carry out the key generation by choosing d and then computing e as the [14]modular multiplicative inverse of d modulo φ(n), whereas most current implementations of RSA, such as those following [15]PKCS#1, do the reverse (choose e and compute d). Since the chosen key can be small whereas the computed key normally is not, the RSA paper's algorithm optimizes decryption compared to encryption, while the modern algorithm optimizes encryption instead.^[16][2]^[17][21] References 1. https://en.m.wikipedia.org/wiki/RSA_(cryptosystem) 2. https://en.m.wikipedia.org/wiki/RSA_(cryptosystem)#cite_note-rsa-2 3. https://en.m.wikipedia.org/wiki/Euler_totient_function 4. https://en.m.wikipedia.org/wiki/Euler_totient_function 5. https://en.m.wikipedia.org/wiki/Lagrange's_theorem_(group_theory) 6. https://en.m.wikipedia.org/wiki/Multiplicative_group_of_integers_modulo_n 7. https://en.m.wikipedia.org/wiki/RSA_(cryptosystem)#Using_the_Chinese_remainder_algorithm 8. http://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.186-4.pdf#page=62 9. https://en.m.wikipedia.org/wiki/RSA_(cryptosystem)#cite_note-17 10. https://en.m.wikipedia.org/wiki/RSA_(cryptosystem)#cite_note-rsa-2 11. https://en.m.wikipedia.org/wiki/RSA_(cryptosystem)#cite_note-18 12. https://en.m.wikipedia.org/wiki/RSA_(cryptosystem)#cite_note-19 13. https://en.m.wikipedia.org/wiki/RSA_(cryptosystem)#cite_note-20 14. https://en.m.wikipedia.org/wiki/Modular_multiplicative_inverse 15. https://en.m.wikipedia.org/wiki/PKCS1 16. https://en.m.wikipedia.org/wiki/RSA_(cryptosystem)#cite_note-rsa-2 17. https://en.m.wikipedia.org/wiki/RSA_(cryptosystem)#cite_note-21