Alice encrypts with EncK, Bob decrypts with DecK: M = DecK(C). Eve sees C, but not K.
Perfectly secret, but the key must be random,
as long as the message, and used only once.
Each byte is replaced using a fixed table (the S-box).
Click any bit. XOR: 1 when the two bits differ.
Assumption: without the key, AES output looks random.
No known attack is much faster than trying every key.
| number of keys | 2128 ≈ 3.4 × 1038 |
| a very fast attacker | 1018 keys per second |
| time to try them all | ≈ 10 trillion years |
about 800 times the age of the universe
Identical plaintext blocks give identical ciphertext blocks.
| Mode | How it works | Security |
|---|---|---|
| ECB | encrypt each block independently | insecure: leaks patterns |
| CBC | chain each block into the next, random IV | secure if used properly |
| CTR | encrypt a counter, XOR with the message | secure if the nonce is never reused |
| GCM | CTR plus authentication | secure, and detects tampering |
| SIV | synthetic IV (misuse-resistant) | nonce reuse only reveals repeated messages |
Alice and Bob have never met, and Eve hears everything.
How can they agree on a secret key?
Like an open padlock: anyone can snap it shut (pk),
only Bob’s key opens it (sk).
pk = (n, e) sk = (n, d)
C = Me mod n
M = Cd mod n
Claim. (Me)d ≡ M (mod n) for every 0 ≤ M < n.
Since ed ≡ 1 (mod φ(n)): ed = 1 + k(p − 1)(q − 1) for some integer k.
Step 1. Med ≡ M (mod p):
Step 2. The same argument with q: Med ≡ M (mod q).
Step 3. p and q are distinct primes, so by the Chinese Remainder Theorem
Security rests on the assumption that factoring large n is infeasible.
Bob wants to know:
| AES | RSA | |
|---|---|---|
| speed | fast | slow |
| shared secret key needed | yes | no |
| used for | encrypting the data | sharing the key, signatures |
Real systems use RSA to share an AES key, then AES for everything else.
Shor’s algorithm factors in polynomial time.
Broken by a large quantum computer.
Grover’s algorithm: only a square-root speed-up.
Still secure with 256-bit keys.