Tech●●●●●Difficulty 5 of 5

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 story

You 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.

One round of the Ali Baba cave
  1. Step 1: Peggy goes in by A or B

    Victor waits outside and cannot see which

  2. Step 2: Victor picks a path at random

    He shouts A or B for her to come out by

  3. Step 3: Peggy comes out as asked

    With the magic word she can always do it

  4. 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

00.250.50.75102468roundschance of passing every round so far

y = 1 · 0.8ˣ

Challenge · Slide the chance to the cave's value so that a cheat has a 25% chance after two rounds.

A simple model of the cave: the cheat survives each round with chance b. At b = 0.5, as in the cave, the chance halves every round.

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

  1. 1.In the Ali Baba cave, why does repeating the challenge convince Victor?
  2. 2.Why is a recording of a zero-knowledge proof not convincing to a third party?
  3. 3.What did Goldreich, Micali and Wigderson show about zero-knowledge proofs?

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.

Sources (2)

No source, no claim. Every fact in this lesson (19 claims) cites at least one of these.

  1. [1]Zero-knowledge proof · Wikipedia
  2. [2]Non-interactive zero-knowledge proof · Wikipedia
More lessons in 💻 Tech (3) See all tech lessons →

One more light on your map.

Get one lesson like this every day, about the things you love. Free, in two or five minutes.

Get the share card for this lesson ↗