How can you prove you know a secret without revealing it?
A cave shaped like a ring, a magic door and a coin flip: the story that explains how you can convince someone you know a secret while telling them nothing.
▶ Start the storyYou do it by letting the other person challenge you, again and again, with questions you can only answer reliably if you really know the secret. A zero-knowledge proof is a protocol in which a prover convinces a verifier that a statement is true without conveying any information beyond the fact that it is true. Proving you hold a secret is trivial if you simply reveal it. The hard part is to prove it without revealing any aspect of it.
The classic picture is the Ali Baba cave, first published in 1990 by Jean-Jacques Quisquater and others in a paper called How to Explain Zero-Knowledge Protocols to Your Children. Peggy knows the magic word that opens a door in a ring-shaped cave. She walks in by path A or B while Victor waits outside and cannot see which. Victor then shouts a randomly chosen path for her to come back by. If Peggy knows the word, this is easy: she opens the door if needed and returns the way he asked. If she does not, she can only succeed by luck, a 50 percent chance each time. Repeat it 20 times and her chance of anticipating every request drops to roughly one in a million.
Step 1: Peggy goes in by A or B
Victor waits outside and cannot see which
Step 2: Victor picks a path at random
He shouts A or B for her to come out by
Step 3: Peggy comes out as asked
With the magic word she can always do it
Step 4: Repeat until luck is impossible
A cheat survives 20 rounds only about once in a million
Try it
How fast a cheat's luck runs out
y = 1 · 0.8ˣ
Challenge · Slide the chance to the cave's value so that a cheat has a 25% chance after two rounds.
Victor never learns the word, and neither does anyone else. Even a hidden camera would record only Victor shouting A and Peggy appearing at A, something any two people could fake by agreeing beforehand, so the recording convinces nobody but the two of them.
The same idea now protects real systems. A zero-knowledge proof can show a website that you are over 18 by proving you own a passport signed by a valid government key for an age over 18, without revealing your name or country. In 2016 Princeton researchers demonstrated a technique that could let inspectors confirm whether an object is a nuclear weapon without recording or revealing its secret internal workings.
Quiz me
0/3
Recap
A zero-knowledge proof repeats a random challenge that only someone who knows the secret can always pass, so the odds against a cheat shrink every round, yet the verifier learns nothing it could reuse.
💡 A trick to remember it · Ask, answer, repeat: each round halves a cheat's luck, and not one word of the secret leaves the cave.
Surprising fact · Researchers have shown a technique built on this idea that could let inspectors confirm an object is a nuclear weapon without revealing its internal workings.
Connects to
- 🛡️ What kind of lock could a quantum computer not pick?
- 🧩 Why are some puzzles quick to check but, as far as we know, slow to solve?
- 🪙 How did an anonymous white paper turn into money nobody controls?
- 🔑 How do computers tell a file hasn't been changed?
- 🔐 How can two strangers agree on a secret while everyone is listening?
Sources (2)
No source, no claim. Every fact in this lesson (19 claims) cites at least one of these.