The Dining Cryptographers

A ring of diners, a secret coin between each pair of neighbours, and one message. Everyone at the table can read it. Nobody can work out who sent it.

Your message

Diners

Who speaks?

What the table hears

Play a round and every diner's announcement shows up here, eight dots to a byte.
How does that work?

The classic story, by David Chaum (1988): three cryptographers finish dinner and the waiter says the bill has been paid. Either one of them paid, or someone else did. They want to know which, without exposing the one who paid.

Every pair of neighbours flips a coin that only the two of them can see. Each diner then says one thing out loud: whether their two coins match. The one who paid says the opposite. Add up all the answers with XOR (1 + 1 = 0) and every coin is counted exactly twice, once by each person who saw it, so all the coins cancel. What's left is the payer's flipped bit: someone paid, and the maths can't point at who.

Here every "coin" is 32 random bytes from your browser's crypto instead of one bit, so a diner can slip in a whole message. Each announcement looks like noise; the sum is the message. Peek under the napkins to see the secrets and watch them cancel.

Two people speaking in the same round get their messages XORed together into garbage, which is why real DC-nets take turns or reserve slots first. Two neighbours who gang up and compare coins can unmask the person sitting between them; the more diners, the harder that gets.

Take turns shows one way to share out the slots: everyone draws a number in secret, the table tries each number, and whoever clashed draws again until everyone has a slot of their own.

With friends there are no real napkins, only a group chat everyone can read. So each of you posts the public half of a key, and each pair of neighbours combines it with their own secret half (ECDH) to land on the same secret without ever saying it. That secret is stretched into fresh coins for every round (HKDF). Then the table shares out slots the Take turns way, except that all the slots of a phase travel in one wide line, so a phase costs each of you one post and one paste. Once every slot is taken, everyone's words go round in one last wide line, each in their own slot, and nothing collides.

Next door: the Dining Philosophers, who can't share forks without freezing.

build v1.5 · 2026-11-02