RSA Algo Basics


  • Choose 2 Large Prime Numbers p and q
  • $n = p \times q$(n is the modulus for both the public and private exponent)
  • Compute Euler Totient $\Phi(n) = (p -1) \times (q -1)$

Euler's Totient Function $\Phi(n)$ is defined to be the number of positive integers less than or equal to n that are coprime to n

  • Let Public Key $pubkey$ be some large number (Random Large Number)
  • Private Key $prikey$ = $pubkey \times modInverse(\Phi(n))$

Encrypt Message

  • $message \times modPow(publicKey, n)$

Decrypt Message

  • $message \times modPow(privateKey, n)$
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License