Path: blob/main/foundations/01-modular-arithmetic-groups/connect/rsa-key-generation.ipynb
483 views
Connect: RSA Key Generation
Module 01 | Real-World Connections
Every concept from this module shows up in RSA. Here's exactly where.
Introduction
You've learned about modular arithmetic, groups, generators, subgroups, and Lagrange's theorem. RSA uses all of these. Let's trace the connections.
Is the RSA Group
RSA operates in the multiplicative group of units modulo , where and are distinct primes. This is exactly the group that we studied in Module 01 --- the set of integers from to that are coprime to , under multiplication.
= Group Size --- The Secret at the Heart of RSA
The order of the RSA group is .
This is the secret. Anyone can know (it's public), but computing requires knowing the factorization . Without , you cannot compute the private key.
This is why RSA security reduces to the hardness of integer factorization: if you can factor , you learn and , compute , and recover the private key.
Key Generation
The key generation algorithm:
Choose coprime to --- this uses gcd from Module 01.
Compute --- this is a modular inverse, which exists precisely because .
Encryption and Decryption
Encrypt:
Decrypt:
Both operations are modular exponentiation --- the same power_mod we used throughout Module 01.
Why It Works: Euler's Theorem
Decryption works because of Euler's theorem, which says that for any unit :
Since , we can write for some integer . Then:
This is exactly Lagrange's theorem in action: every element of a group, raised to the order of the group, gives the identity.
Concept Map: Module 01 RSA
| Module 01 Concept | RSA Application |
|---|---|
| RSA works in where | |
| Units and | determines key generation |
| Modular exponentiation | Encryption () and decryption () |
| gcd | Choosing coprime to |
| Modular inverse | Computing private key |
| Euler's theorem | Why decryption reverses encryption |
What's Next
Module 04 builds all of this from scratch --- the extended Euclidean algorithm for computing inverses, a full proof of Euler's theorem, and a complete RSA implementation with proper padding and security analysis.
Summary
| Concept | Key idea |
|---|---|
| RSA group | , the multiplicative group of units mod |
| Group order | is the secret that enables key generation |
| Key generation | Uses gcd (to choose ) and modular inverses (to compute ) |
| Encryption and decryption | Both are modular exponentiation: , |
| Correctness | Follows from Euler's theorem: |
Every tool from this module, modular arithmetic, groups, orders, and Euler's theorem, is load-bearing in RSA. None of it was abstract for its own sake.