RSA #
RSA is a public-key cryptosystem used for secure data transmission over the internet.
Key Generation #
Prime Numbers #
Generate two large prime numbers \( p \) and \( q \) .
Calculate n and totient of n #
\[ n = p * q \] \[ \phi(n) = (p-1)(q-1) \]Calculate e #
\( e \) is a number relatively prime to \( \phi(n) \) .
\[ e \in \mathbb{Z}^{+} \] \[ e < \phi(n) \] \[ gcd(e, \phi(n)) = 1 \]Calculate d #
\( d \) is the modular inverse of \( e \) mod \( \phi(n) \) .
\[ d \in \mathbb{Z}^{+} \] \[ d*e \ mod \ \phi(n) = 1 \]Generate Key Paior #
\( (e,n) \) is the public key.
\( (d,n) \) is the private key.