A substitution cipher maps each plaintext letter to a fixed ciphertext letter. Caesar's shift is a special case: c ≡ p + k (mod 26).
The key space looks enormous — 26! ≈ 4 × 1026 permutations — yet any natural-language ciphertext leaks structure.
PLAIN → THE QUICK BROWN FOX
CIPHER → YDW UPHKB OAJZQ MJC
Lesson: security cannot rest on key-space size alone. Distribution matters.
Encrypt by XOR-ing the message with a uniformly random key of equal length:
Decrypt the same way: m = c ⊕ k. If k is truly random and used only once, the ciphertext reveals nothing about the plaintext.
m = 01001000 01001001 k = 10110101 11001100 ⊕ c = 11111101 10000101
Perfect secrecy is achievable. But every modern system is a compromise around the impracticality of OTP.
Working mod n means we identify integers that differ by a multiple of n:
When n = p is prime, the set ℤ/pℤ becomes a finite field: every nonzero element has a multiplicative inverse.
Computation in finite fields is fast; inversion via the extended Euclidean algorithm is the workhorse of key generation.
If n = p·q with primes p, q, then
Choose e coprime to φ(n); compute its inverse d ≡ e−1 (mod φ(n)). Then for any m:
Encryption and decryption are both modular exponentiation — cheap if you know the factorization, intractable if you don't.
encrypt: c = me mod n
decrypt: m = cd mod n
Two strangers establish a shared key over an open wire. Public parameters: a prime p and generator g.
Eve sees: g, p, ga, gb
Eve wants: gab
Modular exponentiation is a one-way function with structure: easy forward, hard inverse, but it commutes — (ga)b = (gb)a.
That single algebraic property — commutativity of exponents — is what allows two parties to converge on the same secret without ever transmitting it.
An elliptic curve over a field is the set of points satisfying:
The points form an abelian group under a chord-and-tangent addition law. "Multiplication" of a point P by integer k is repeated addition: kP.
256-bit ECC ≈ 3072-bit RSA in security — smaller keys, faster operations, less power. Why your phone uses Curve25519.
A cryptographic hash H : {0,1}* → {0,1}n compresses any input to a fixed-length digest. Three properties matter:
SHA256("hello") =
2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824
A signature scheme is a triple (KeyGen, Sign, Verify):
Naive RSA signing: σ = H(m)d mod n; verify: σe ≡ H(m) (mod n).
Encryption hides; signatures bind. They are dual operations on the same key pair.
Goldwasser, Micali, Rackoff (1985): a zero-knowledge proof lets a prover convince a verifier of a statement without leaking anything else.
Three properties:
Applications: anonymous credentials, private blockchains, verifiable computation, identity without disclosure.
Shor's algorithm (1994) factors integers and computes discrete logs in polynomial time on a sufficiently large quantum computer. RSA, DH, and ECC all fall.
NIST's post-quantum standardization (2022–24) selected new primitives based on problems Shor cannot crack.
The migration is the largest crypto transition in history — already underway in TLS, Signal, and OS-level key stores.
"Every secret has a structure. Cryptography is the study of which structures keep their shape under adversarial scrutiny."
// nav: ← → arrows, space, click
// 13 / 13 — transmission complete