๐Ÿ” RSA Key Generator

Interactive Educational Tool for Understanding Public-Key Cryptography

RSA Key Generation Process

What is RSA?

RSA (Rivest-Shamir-Adleman) is a public-key cryptosystem widely used for secure data transmission. It relies on the mathematical difficulty of factoring large composite numbers.

Why Prime Numbers?

Prime numbers are the foundation of RSA security. The algorithm uses two large primes to create keys that are computationally infeasible to break without knowing the original primes.

Generated Keys & Values

RSA Algorithm Steps Explained

1 Select Two Prime Numbers (p and q)

Choose two distinct prime numbers. In real RSA, these are typically 1024-4096 bits long.

p and q must be prime and p โ‰  q
2 Calculate n (Modulus)

Multiply the two primes together to get n, which is part of both public and private keys.

n = p ร— q
3 Calculate ฯ†(n) (Euler's Totient)

Calculate Euler's totient function, which counts numbers less than n that are coprime to n.

ฯ†(n) = (p - 1) ร— (q - 1)
4 Choose Public Exponent (e)

Select e such that 1 < e < ฯ†(n) and gcd(e, ฯ†(n)) = 1. Common choice: e = 65537.

1 < e < ฯ†(n) and gcd(e, ฯ†(n)) = 1
5 Calculate Private Exponent (d)

Calculate d as the modular multiplicative inverse of e modulo ฯ†(n).

d โ‰ก eโปยน (mod ฯ†(n)) or (d ร— e) mod ฯ†(n) = 1
6 Keys Generated!

Public Key: (e, n) - Share this freely for encryption

Private Key: (d, n) - Keep this secret for decryption