Read this lesson as text
Complete RSA Example
Number Theory · Axiom Academy
Step-by-step walkthrough of RSA encryption and decryption with concrete numbers Excellent work! You've completed a full RSA encryption and decryption cycle. Here's what we learned: Key Generation: RSA security relies on choosing two large primes p and q, computing n = pq and phi(n) = (p-1)(q-1), then finding e and d such that ed = 1 (mod phi(n)) Public vs Private: The public key (n, e) can be shared openly for encryption, while the private key (n, d) must be kept secret for decryption Modular Exponentiation: Both encryption (c = m^e mod n) and decryption (m = c^d mod n) use modular exponentiation, which is efficient to compute but hard to reverse without the private key Mathematical Foundation: RSA's security depends on the difficulty of factoring large numbers - if someone could factor n into p and q, they could compute phi(n) and derive the private key d Real-world Application: In practice, RSA uses much larger primes (typically 1024-4096 bits) to ensure security against modern factoring attacks This complete example demonstrates why RSA is a cornerstone of modern cryptography. Practice with different primes to build intuition!
This is the written version of the interactive lesson above. See the full Number Theory course.