Section 9: Advanced Topics

Everything so far has been about two verbs: encrypt and sign. Hide a message; vouch for a message. But the frontier of cryptography is stranger and more ambitious than that. This section tours four ideas that sound impossible until you see the trick: proving a statement is true without revealing why; computing on data while it stays encrypted; algorithms that survive an adversary armed with a quantum computer; and groups of mutually distrustful parties jointly computing an answer without anyone showing their input. None of this is science fiction — all four are deployed, standardized, or shipping in browsers today. What unites them is a shift in mindset: cryptography stops being a lockbox and becomes a way to control exactly what information a computation leaks — often, precisely zero.

Zero-knowledge proofs: proving without revealing

A zero-knowledge proof (ZKP) lets a prover convince a verifier that a statement is true while revealing nothing else — not the reason, not the evidence, not a single extra bit. "I am over 18" without showing a birthdate. "This transaction balances" without showing the amounts. "I know the password" without typing the password.

The classic intuition is the Ali Baba cave. Imagine a circular cave with one entrance that forks into two passages, A and B, which reconnect deep inside — but the connecting point is sealed by a magic door that opens only with a secret word. Peggy (the prover) claims she knows the word. Victor (the verifier) wants proof, but Peggy refuses to say the word aloud.

magic door Victor waits here passage A passage B fork
The Ali Baba cave: passages A and B meet only at the magic door. Only someone who knows the secret word can pass through it.

The protocol: Peggy walks in first and randomly disappears down A or B — Victor does not see which. Victor then walks to the fork and shouts a random demand: "come out of A!" (or B). If Peggy knows the word, she can always comply — if she happens to be in the wrong passage, she just opens the door and crosses over. If she does not know the word, she is stuck in whichever passage she picked and can only obey if Victor happens to name it: a 50% chance. One round proves little. But after 20 rounds, a faker survives only with probability (1/2)20 — about one in a million. Crucially, Victor learns nothing about the word itself; all he ever sees is Peggy emerging from a passage he named, something he could have staged himself with a cooperative actress. That last observation is the essence of "zero knowledge": the transcript could have been faked, so it cannot contain real information.

Every zero-knowledge proof must satisfy three properties:

The cave protocol is interactive: it needs many live rounds of challenge and response. Most real applications want a non-interactive proof — a single blob anyone can verify later. The Fiat-Shamir transform achieves this in one elegant move: replace the verifier's random challenges with the output of a hash function over the transcript, so the prover effectively challenges herself in a way she cannot bias.

Modern proof systems compress this idea to an extreme. zk-SNARKs produce proofs of a few hundred bytes verifiable in milliseconds — for statements about arbitrarily large computations — but classically require a trusted setup ceremony whose leftover randomness ("toxic waste") must be destroyed, or an attacker could forge proofs. zk-STARKs drop the trusted setup and rely only on hash functions (which also makes them plausibly quantum-resistant), at the cost of proofs tens of kilobytes large.

zk-SNARKzk-STARK
Proof sizeTiny (~hundreds of bytes)Larger (tens to hundreds of KB)
Trusted setupUsually required (ceremony)None — transparent
VerificationVery fastFast, scales well
AssumptionsElliptic-curve pairingsHash functions only
Quantum resistanceNoPlausibly yes

Real deployments: Zcash uses zk-SNARKs to validate fully shielded transactions — the blockchain verifies that money was neither created nor stolen without seeing sender, receiver, or amount. zk-rollups (StarkNet, zkSync) bundle thousands of Ethereum transactions off-chain and post one succinct proof that all of them were executed correctly. And digital identity schemes are beginning to offer age verification without a birthdate: your ID issuer signs your data once, and you prove "the signed birthdate is before 2008" — nothing more.

Try being a verifier yourself. The classic demonstration for a claim like "these two balls are different colors" — made to a color-blind verifier — works exactly like the cave: the verifier randomly swaps or does not swap the balls behind their back, and asks the prover "did I swap?". A prover who can genuinely see the colors is always right; a liar facing identical balls can only guess.

ZK color-blind verifier: two billiard balls

The page (the prover) claims the two hidden balls are different colors. You are the color-blind verifier: you cannot see them. Each round, click a button — the page secretly flips a fair coin to swap or not, then the prover announces whether a swap happened. Watch it never miss.

Click "Run a round" to challenge the prover.

What this demonstrates: each correct answer halves the chance the prover is bluffing, so confidence climbs as 1 − (1/2)n — yet you, the verifier, end the protocol still not knowing which ball is which color. You gained certainty about the statement ("they differ") and zero knowledge about the secret (the actual colors). That asymmetry is the whole trick.

Homomorphic encryption: computing on ciphertext

Normally, encrypted data is inert — to do anything useful with it you must decrypt it first, and the moment you do, whoever runs the computation sees your data. Homomorphic encryption breaks that trade-off: the ciphertexts themselves can be added or multiplied, and the result, when decrypted, equals what you would have gotten by computing on the plaintexts. The analogy: a locked glovebox in a jeweler's shop. You put raw gold inside and lock it; the jeweler works the metal through built-in gloves without ever opening the box; you unlock it and take out a finished ring. The worker computed on your material without ever possessing it.

There is a hierarchy of power:

Performance reality check
FHE is real but expensive: depending on the workload, computations run thousands to millions of times slower than on plaintext, and ciphertexts are orders of magnitude larger. The gap is closing fast — mature open-source libraries like Microsoft SEAL and OpenFHE, better schemes (BGV, BFV, CKKS, TFHE), and emerging hardware accelerators have already brought some encrypted workloads into practical range. For narrow, high-value tasks it is usable today; for general computing, not yet.

Why endure that cost? Because some data must never be exposed: private cloud compute (the server processes your medical records without being able to read them), encrypted machine-learning inference (a model scores your encrypted input; the provider never sees your data, you never see their model), and private set intersection (two companies find common customers without either revealing its customer list — this is roughly how phones check your contacts against a breach database privately).

The widget below demonstrates the simplest real homomorphism with actual numbers: textbook RSA with a toy modulus. Watch two ciphertexts multiply into the valid encryption of the product — the "server" doing that multiplication never learned a, b, or a·b.

RSA multiplicative homomorphism (toy numbers)

Toy RSA key: n = 3233 (61×53), e = 17, d = 413. Enter two small numbers; the page encrypts each, multiplies only the ciphertexts mod n, then decrypts the product ciphertext.

Post-quantum cryptography: surviving Shor

Every public-key scheme in this course so far — RSA, Diffie-Hellman, elliptic curves — rests on one of two problems: factoring large integers, or computing discrete logarithms. In 1994 Peter Shor showed that a sufficiently large quantum computer solves both efficiently. The mechanism, in one breath: both problems reduce to finding the period of a repeating function, and a quantum computer can put a function into superposition over all inputs at once and use a quantum Fourier transform to read off the period — the exact task classical machines find hopeless at scale. Period found, RSA factored, discrete log computed, private key recovered. Symmetric cryptography fares far better: Grover's algorithm gives only a quadratic speedup on brute-force search, effectively halving key lengths — AES-256 drops to 128-bit quantum security, which is still entirely comfortable. So the coming quantum transition is overwhelmingly a public-key problem.

Harvest now, decrypt later
No known quantum computer can break RSA-2048 today. That is not reassuring, because adversaries can record encrypted traffic now and decrypt it once quantum computers arrive. Anything that must stay secret for 10+ years — state secrets, medical records, corporate IP — is effectively already at risk if it crosses the wire under quantum-vulnerable key exchange. This is why migration started years before any quantum machine existed.

NIST ran a public, worldwide competition from 2016 to select replacements, and in August 2024 published the first finished standards:

The lattice schemes are built on Learning With Errors (LWE). The intuition: solving a system of exact linear equations is trivial — high-school Gaussian elimination. But add a small random error to every equation, and the problem flips from trivial to (as far as anyone knows, even with a quantum computer) intractable: the noise poisons elimination, errors compound instead of canceling, and recovering the secret becomes equivalent to finding the closest point in a lattice of enormous dimension. The legitimate key holder is fine, because the scheme is engineered so the noise stays small enough to round away.

Exact equations (easy):          Noisy equations / LWE (hard):
  5a + 2b = 29                     5a + 2b = 29 + e1
  3a + 7b = 44   -> solve!         3a + 7b = 44 + e2      each e is a small
  ...                              ...                    unknown error
Gaussian elimination works.      Elimination amplifies the errors;
                                 recovering (a, b) is lattice-hard.
    

Hash-based signatures deserve their own intuition: commit to secret random values by publishing their hashes, then sign by selectively revealing preimages corresponding to the bits of the message digest. Forging requires inverting a hash. Merkle trees turn a pile of such one-time keys into one compact long-lived public key. Because the only assumption is "the hash function is good," SLH-DSA is the choice when you want minimal trust in new math.

Classical primitiveQuantum statusPost-quantum replacement
RSA (encryption, signatures)Broken by ShorML-KEM / ML-DSA
Diffie-Hellman, ECDHBroken by ShorML-KEM (Kyber)
ECDSA, Ed25519Broken by ShorML-DSA, SLH-DSA
AES-256Weakened by Grover to ~128-bitKeep AES-256 — fine
SHA-256 / SHA-3Modest Grover-type speedupsKeep, or use larger variants

Migration is not hypothetical. Chrome and Cloudflare already run hybrid X25519 + ML-KEM key exchange in TLS — a large share of Cloudflare-bound human traffic negotiates post-quantum protection today. The hybrid construction combines a classical and a post-quantum exchange, so security holds unless both are broken — insurance while the new math accumulates mileage.

Secure multi-party computation: joint answers, private inputs

Secure multi-party computation (MPC) asks: can several parties jointly compute a function of their private inputs so that everyone learns the output and nothing else? The founding puzzle is Yao's millionaires problem (1982): two millionaires want to know who is richer without either revealing their wealth. It sounds like it should require a trusted referee — MPC's achievement is that it does not. The protocol itself plays the referee, and provably leaks nothing beyond the answer.

The simplest gateway is additive secret sharing. To share a salary s among three parties, generate two random numbers r1, r2 and set the third share to s − r1 − r2 (mod some large number). Each share individually is uniformly random — a single share carries literally zero information about s, like one piece of a torn banknote. But shares are additively aligned: if everyone shares their own salary this way, distributes the pieces, and each party sums the pieces it holds, then the three per-party sums add up to the total of all salaries — while no party ever saw anyone else's actual number. Sum in hand, the average falls out.

Addition is the easy case. For arbitrary functions, Yao's garbled circuits do something remarkable: one party takes the function as a Boolean circuit and "garbles" it — replacing every wire value with a random cryptographic label and every gate with a little table of encryptions, so that holding the right input labels lets you decrypt exactly one output label per gate and nothing else. The other party obliviously obtains the labels for its own input bits (without revealing which bits) and then evaluates the whole circuit label by label, learning only the final output. The circuit runs; the inputs stay opaque; even the evaluator cannot tell what values flowed through the wires.

Real uses: Denmark ran a nationwide sugar-beet auction on MPC in 2008, matching farmers and the buyer at a fair clearing price with all bids kept private. Banks run joint fraud detection across institutions without pooling raw customer data. And distributed key generation — creating a key that exists only as shares, never assembled in one place — underpins the threshold systems in the next section.

Average salary without revealing salaries

Three parties want their average salary. Each splits their salary into 3 random shares (mod 1,000,003), keeps one, and sends one to each other party. Enter three salaries and watch the average emerge from numbers that individually reveal nothing.

Threshold cryptography: no single point of key compromise

A private key is a terrifying object: whoever holds it is you, and a single theft, insider, or subpoena captures it whole. Threshold cryptography dissolves the key into n shares such that any k of n can act (decrypt, sign) while any k−1 shares reveal nothing at all. Think of a bank vault needing any 3 of 5 officers' keys: no single rogue officer can open it, and losing one officer does not lock the vault forever. Both properties matter — threshold schemes buy security and availability at the same time.

The foundational construction is Shamir Secret Sharing (1979), and its engine is a fact you learned in school: two points determine a line; three points determine a parabola; k points determine a unique polynomial of degree k−1. To share a secret s with threshold k, hide s as the y-intercept of a random degree-(k−1) polynomial and hand each party one point on the curve. Any k parties can interpolate the polynomial (Lagrange interpolation) and read off f(0) = s. Any k−1 parties hold too few points: for every possible secret value, there is a polynomial through their points and that value — so their shares are consistent with every secret equally. That is not "hard to break"; it is information-theoretically perfect, secure against unlimited computing power, quantum or otherwise.

secret = f(0) 2 points fix a line (k = 2) secret = f(0) 3 points fix a parabola (k = 3)
Shamir in one picture: with fewer points than the threshold, infinitely many curves — and therefore every possible y-intercept — remain consistent.

Threshold signatures push the idea further: the parties never reconstruct the key at all. Each holds a share forever, they run a small MPC protocol to produce signature fragments, and the fragments combine into one ordinary-looking signature. The private key exists only as a mathematical abstraction, never as bytes in any single machine's memory — there is nothing to steal in one place. This is how serious cryptocurrency custody works (exchanges splitting withdrawal keys across data centers and officers), how root key ceremonies protect the DNSSEC root and CA roots (multiple geographically separated smartcard holders), and how distributed certificate authorities remove the single HSM whose compromise would poison the whole trust chain.

Shamir 2-of-3 secret sharing (prime field p = 2003)

Enter a secret (0 to 2002). The page picks a random line f(x) = secret + m·x mod 2003 and issues shares f(1), f(2), f(3). Then pick any two shares to reconstruct f(0) by Lagrange interpolation — and notice any single share alone is consistent with every possible secret.

Check your understanding

Where to learn more

videoComputerphile — Zero Knowledge Proofs
A friendly on-camera walkthrough of the core ZKP idea with concrete examples.
articleZero Knowledge Proofs: An Illustrated Primer — Matthew Green
The best written introduction to ZKPs: graph coloring, simulators, and why zero knowledge actually means zero, from a Johns Hopkins cryptographer.
articleVitalik Buterin — ZK-SNARKs blog series
A working tour of how SNARKs and STARKs are actually built — polynomial commitments, QAPs, and rollups — from the Ethereum side.
articleNIST Post-Quantum Cryptography project
The official home of the PQC standardization effort: FIPS 203/204/205, ongoing rounds, and migration guidance.
pdfA Graduate Course in Applied Cryptography — Boneh & Shoup
Free, rigorous, and modern: the reference text covering ZK protocols, lattices, and post-quantum foundations with full proofs.
bookA Pragmatic Introduction to Secure Multi-Party Computation
Free book by Evans, Kolesnikov, and Rosulek: garbled circuits, secret sharing, oblivious transfer, and real MPC deployments.