Day 32 · 2026.07.24

The Mathematics of Cryptography

How to keep a secret in a world where the enemy is listening
"The enemy knows the system." Security never rests on hiding the algorithm — only on a key no one can reverse. — Kerckhoffs's principle

Modular Arithmetic & RSA

A door that opens in only one direction
Number Theory
Intuition

Clock arithmetic: reach 12, take one more step, and you land back on 1 — numbers wrapped into a circle. What cryptography prizes is that this circle hides a kind of one-way door: trivial to walk forward, all but impossible to walk back. Multiplying two large primes takes a second; but hand someone the several-hundred-digit product and ask them to split it back into those two factors, and all the computing power on Earth would need astronomical time.

RSA locks its secret inside that asymmetry: multiplying is bolting the door, factoring is the only keyhole. Anyone can encrypt by the public rule (bolt the door), yet only the holder of the prime factors can open it — because only they sidestep the factoring problem.

$$c \equiv m^{e}\pmod{n},\qquad m \equiv c^{d}\pmod{n}$$
Formal definition

Take two large primes $p,q$ and let $n=pq$. The public key is $(n,e)$, the private key $d$, bound by $ed\equiv 1\pmod{\varphi(n)}$ (where $\varphi(n)=(p-1)(q-1)$ is Euler's totient). Encryption raises $m$ to the $e$; decryption raises $c$ to the $d$; the round trip restores the plaintext $m$ — guaranteed by Euler's theorem, $m^{\varphi(n)}\equiv 1$. The crux: computing $\varphi(n)$ is equivalent to factoring $n$, and without $p,q$ you cannot recover $d$. Publishing $n$ is harmless; it does not betray the private key.

Why it's beautiful

The beauty is that encryption and decryption are the same operation applied twice: raise to $e$, then to $d$, and since $ed\equiv1$, one full loop around the modulus lands exactly back at the start. A pure number-theoretic fact — Euler's theorem — is turned around and used as the bedrock of engineering. Better still, the "hardness" here is not proven hardness but three centuries of un-cracked experience: the trust of the entire digital world hangs on an unsolved mathematical problem.

Applications

Every little padlock in your browser traces back to it: the TLS/HTTPS handshake, SSH, PGP email. Digital signatures run it in reverse — the private key "decrypts" a digest, and anyone can verify with the public key — giving software updates, certificates, and e-contracts a signature that cannot be repudiated.

In one line: RSA turns "keeping a secret" into an arithmetic problem humanity can't yet solve — factoring large numbers.
To ponder: RSA's security is not proven, only "un-factored so far." Staking the trust of the whole financial system on an open mathematical problem — is that boldness, or simply having no better option?

Elliptic Curve Cryptography

Reinventing addition on a curve
Algebraic Geometry
Intuition

Forget the formulas for a moment; picture a smooth, symmetric curve. Now define a strange "addition": through two points $P,Q$ on the curve draw a straight line — it must strike the curve at a third point — then flip that point across the horizontal axis. That is $P+Q$. Absurd? And yet these rules snap together into a genuine group: identity, inverses, associativity, all of it.

Add a point $P$ to itself $k$ times to get $kP$, like hopping $k$ steps along the curve; hopping is fast. But reverse it: given only the start $P$ and the landing point $kP$, asking how many steps were taken is yet another one-way door — steeper even than factoring.

P Q R P+Q
Draw the line through $P$ and $Q$, meet the curve at $R$, flip across the axis — that is $P+Q$. A geometric construction is the group's addition.
Formal definition

The curve is $y^2=x^3+ax+b$ (with points taken discretely over a finite field). Point addition is as above; repeating it defines scalar multiplication $kP$. Security rests on the elliptic-curve discrete logarithm problem (ECDLP): given $P$ and $kP$, recovering the integer $k$ is computationally infeasible. Because the best known attacks get no traction, ECC reaches RSA-3072 strength with just a 256-bit key — equal security, a far shorter key.

Why it's beautiful

The beauty is the fusion of geometry and algebra: a curve you can sketch with a pencil, and the purely visual act of "draw a line, take the intersection," turn out to be the operation law of an abstract group. The construction you can see and the structure you cannot are two faces of one thing. Its practical beauty is just as striking — packing security into a shorter key is exactly what phones, smart cards, and IoT, counting every byte, demand.

Applications

Every signature on Bitcoin and Ethereum runs on the curve secp256k1; modern TLS key exchange (ECDHE), the secure enclaves in Apple and Android devices, and Signal's end-to-end encryption have almost wholly replaced RSA with ECC. Shorter keys mean faster handshakes and less battery — a necessity of the mobile era.

In one line: redefine "addition" on a curve, and a geometric construction becomes cryptography's lock.
To ponder: for the same security, ECC's key is a fraction of RSA's. "Shorter yet stronger" feels paradoxical — does security come from the length of the key, or from the steepness of the problem behind it?

Lattice-based & Post-Quantum

Re-laying the foundation for the quantum age
Geometry of Numbers
Intuition

The bad news first: Shor's algorithm lets an ideal quantum computer factor large numbers and break discrete logarithms efficiently — RSA's and ECC's two one-way doors collapse at once. Cryptography needs a new problem that even a quantum machine can't pry open.

The answer hides in high-dimensional "lattices": picture a regular grid of points stretching endlessly through space. Hand someone a messy set of basis vectors and ask for the lattice point nearest to a given spot — in high dimensions this becomes a needle in a haystack; yet with a "nice" basis in hand, the same question is instantly solvable. That good basis is the trapdoor. Against this high-dimensional geometry, quantum computers remain, to this day, helpless.

$$\mathbf{b}=A\mathbf{s}+\mathbf{e}\pmod{q}$$
Formal definition

The workhorse problem is Learning With Errors (LWE): given a random matrix $A$ and a vector $\mathbf b$, where $\mathbf b$ comes from a secret $\mathbf s$ through a linear map plus a little added noise $\mathbf e$, recover $\mathbf s$. Without the noise this is high-school equation solving; with the noise it becomes equivalent to finding the nearest point in a high-dimensional lattice — among the hardest problems known. Crucially it reduces to the worst-case hardness of lattices: breaking an average instance is no easier than breaking the hardest one.

Why it's beautiful

The beauty is that pinch of noise: merely sprinkling a small error into a clean linear system lifts a problem a schoolchild could solve into a wall a quantum computer cannot budge. "Hard" is no longer luck — no one happened to crack it — but firmly pinned to the worst case. This average-to-worst-case reduction is the rigor cryptography dreams of. With the number-theoretic door forced open by quantum, geometry takes up the watchman's torch.

Applications

In 2024 NIST formally standardized the lattice schemes Kyber (key encapsulation) and Dilithium (signatures), and the world began its "post-quantum migration." Further out, lattices also underpin fully homomorphic encryption — letting the cloud compute directly on ciphertext without decrypting it, opening the door to privacy-preserving AI and confidential data hosting.

In one line: stir a pinch of noise into an equation and you raise a high-dimensional geometric wall that even a quantum computer can't breach.
To ponder: we are re-keying, decades early, against a quantum computer that doesn't yet exist. A "harvest now, decrypt later" adversary — stealing ciphertext today to break it in the future — reshapes the very question of what deserves encrypting now.

Zero-Knowledge Proofs

Proving I know, without telling you what I know
Complexity Theory
Intuition

Ali Baba's ring-shaped cave has a door deep inside that only a magic word opens. You want to convince a friend you know the word — while betraying not one syllable of it. How? Have them wait at the mouth; you walk in by the left or right passage at random; they then shout "come out from the right." If you truly know the word you can obey whichever passage you entered; if you're bluffing, you're on the correct side only half the time.

One shout, and your odds of bluffing are $1/2$; repeat twenty times and the odds of faking it fall below one in a million. They are convinced you know the word, yet never heard a single sound of it — you proved "I know," and the knowledge leaked was zero.

Formal definition

A zero-knowledge proof must satisfy three properties at once: completeness (if the statement is true, an honest prover always convinces the verifier), soundness (if it is false, no cheat succeeds except with tiny probability), and zero-knowledge (the verifier learns nothing beyond the single bit "the statement is true"). How is the third proven rigorously? Via a simulator: if a verifier can, without interacting with any real prover, forge on its own a transcript indistinguishable from a genuine one, then the real conversation plainly hid no useful information either — because fake and real cannot be told apart.

Why it's beautiful

The beauty is how cleanly it severs "proof" from "knowledge." We always assumed that to convince you, one must lay the reasons bare; the zero-knowledge proof instead persuades you "I have the answer" while surrendering not a fraction of it. This near-paradoxical power is finally nailed down by a counterintuitive argument — whatever can be conjured from nothing cannot carry real information. Here cryptography touches the deep water of epistemology: persuasion, it turns out, can part ways entirely with disclosure.

Applications

The privacy coin Zcash uses zk-SNARKs to prove "this transfer is valid" without revealing sender, receiver, or amount; Ethereum's zk-Rollups compress thousands of transactions into one short proof the chain merely verifies instead of re-executing — scaling in a stroke. More broadly, it lets you prove "I'm of age / I'm eligible" without handing over your ID — the cornerstone of privacy-preserving identity.

In one line: zero-knowledge proofs part persuasion from disclosure — I can make you certain, without having to let you know.
To ponder: if every eligibility check could "prove the condition is met without exposing any detail," how would the balance between privacy and accountability be reset? Is "having to reveal nothing" freedom, or a new loss of control?

Going Deeper

Why is all of modern cryptography built on "hard problems" rather than airtight proof?
RSA leans on factoring being hard, ECC on discrete logs being hard, lattices on nearest-point being hard — not one is proven hard. Their security shares a deeper wager: that one-way functions exist (functions easy forward, hard back). And the existence of one-way functions would immediately imply $P\neq NP$ — one of mathematics' greatest open questions. Put differently, if $P=NP$ were ever proven, nearly all public-key cryptography would collapse overnight. The secrecy we lean on daily rests on a conjecture humanity has not proven.
What is the common skeleton beneath the four concepts — RSA, ECC, lattices, zero-knowledge?
All are deliberately engineered asymmetries: one direction effortless, the reverse near-impossible, with the secret being the shortcut — the trapdoor. RSA's trapdoor is the prime factors, ECC's is the scalar $k$, the lattice's is that good basis, and in zero-knowledge it is the "witness" you hold. Almost the whole art of cryptography reduces to one sentence: how to forge a door that is lopsided forward-versus-back, and keep the key firmly in one party's hand. The shape of the hard problem shifts (number theory → geometry → interaction); this skeleton never does.
Shor's algorithm shatters RSA and ECC in a flash — why is it powerless against lattices?
Shor's power comes from period-finding: both factoring and discrete logs reduce to "find a hidden periodic structure," at which the quantum Fourier transform excels. But the nearest-vector problem in a lattice has no such quantum-amplifiable periodic symmetry — it is a naked combinatorial search through high-dimensional space. The deep lesson: a problem's quantum fragility depends on whether it hides an algebraic structure the quantum machine can lever. Post-quantum cryptography bets precisely that lattice problems, structurally, lack that seam.
Do cryptography and AI alignment share the same intuition of "asymmetry"?
An intriguing echo: cryptography builds doors "easy to verify, hard to forge"; alignment builds systems where "beneficial behavior is easy, harmful behavior is incentive-blocked." Both design a structural asymmetry that makes "what we want" far cheaper than "what the adversary wants." Zero-knowledge proofs form a literal bridge — they have been used to verify that an AI truly ran the model it claims, without revealing the weights. When "trustworthy" grows more urgent than "transparent," cryptography happens to supply the language of "prove without reveal."
If $P=NP$ were proven tomorrow, would cryptography simply end?
Public-key cryptography would almost certainly die — trapdoor one-way functions would cease to exist. But not all is lost: the one-time pad offers information-theoretic security, independent of computational hardness, and is forever unbreakable (at the cost of a key as long as the message and never reused). Quantum key distribution stakes security on physical law rather than a math problem. Cryptography might be forced to retreat from "computationally infeasible" to "information-theoretically impossible" and "physically forbidden" — costlier, clumsier, yet also more absolute.