Skip to content
衍门

Series · The Practice

Provably Fair Digital Divination: How Commit–Reveal Cryptography Keeps an Oracle Honest

When you throw three physical coins, the fairness of the cast is self-evident: the coins left your hand, gravity did the rest, and no one — including you — chose the outcome. A digital oracle has a harder problem. However honest its random number generator actually is, you cannot see it. An app could, in principle, serve you gentler hexagrams when you seem anxious, or dramatic ones to keep you engaged, and the result would look exactly like chance.

For most software this would be a quality question. For a contemplative instrument it is foundational. A reading is only worth reflecting on if the symbol genuinely fell to you — if it was not selected for you by anyone's model of what you should hear. This is why the Six Doors instrument does not ask to be trusted. It uses a commit–reveal protocol, borrowed from cryptography, that makes manipulation detectable after every single cast.

The core idea: promise first, act second

A commit–reveal scheme has the structure of a sealed envelope. Before anything happens, one party writes down their contribution, seals it, and hands over the sealed envelope. Only after the other party has acted is the envelope opened. The seal proves the contents were fixed before the other party acted; and because the envelope stayed closed until then, the other party could not act on what it says.

The cryptographic seal is a hash function — here, SHA-256. A hash function turns any input into a fixed-length fingerprint with two properties that matter for us. First, it is one-way: seeing the fingerprint tells you essentially nothing about the input. Second, it is collision-resistant in practice: nobody can produce a second input matching the same fingerprint. Publishing the hash of a secret therefore commits you to that exact secret while revealing nothing about it.

The protocol, step by step

Here is what happens when you cast at Six Doors, in order:

1. The server commits

Before your ritual begins, the server generates a random value called the server seed and sends you its SHA-256 hash — the commit hash. The seed itself stays secret. At this moment the server has locked in its entire contribution to your cast: any later change to the seed would change the hash, and you are holding the hash.

2. You contribute entropy

Each line you cast carries its own entropy, made and sent by your browser: the moments of your taps, in milliseconds, together with eight random bytes from your own device. (The verify page lists it, line by line, as "Your entropy.") This step matters for two distinct reasons. Ritually, it keeps the cast yours: your hands, your moment, your unrepeatable timing shape the outcome, just as they would with physical coins. Cryptographically, it closes the remaining loophole — because the server cannot predict what your browser will send, it could not have chosen a seed in advance that steers your result, even across many attempts.

3. The result is derived deterministically

Each line is computed from an HMAC — a keyed hash. The server seed is the key, taken as text: its 64 hex characters as written, not the bytes they spell. The message is the cast's unique identifier, the line's number (0 for the bottom line, up to 5) and that line's entropy exactly as the verify page lists it, joined by colons:

digest_i = HMAC-SHA256(server_seed, cast_id:i:entropy_i)

With three coins, the lowest bit of each of the digest's first three bytes becomes one coin: 3 if the bit is 1, 2 if it is 0. The three coins sum to 6, 7, 8, or 9, exactly as in the physical three-coin method, and six lines give the eighteen coin faces of a full cast. With yarrow stalks, only the first byte is read: divided by 16, a remainder of 0 gives 6, 1 to 5 give 7, 6 to 12 give 8, and 13 to 15 give 9 — the stalks' own odds. Nothing in this step involves choice. Given the server seed, the cast ID and your six entropies, the hexagram is fully determined — and neither party alone controlled both halves of that input.

4. The server reveals

Once your lines are cast, the server discloses the server seed. Now you hold everything: the commit hash from before the cast, the revealed seed, the entropy of each of your lines, and the result.

Verifying a cast yourself

Verification asks two questions, both mechanically checkable:

Did the server keep its promise? Hash the revealed server seed — as text, the same 64 characters — and compare it to the commit hash you were given before casting. If they match, the seed was fixed before you cast your first line.

Does the result follow from the inputs? For each line, recompute the HMAC from the revealed server seed, the cast ID, the line's number and its entropy, read the line off the digest (the first three bytes for coins, the first byte for yarrow), and compare with the lines you received.

A verification, written as plain arithmetic-by-hash, looks like this:

given:
  commit_hash  = 9f2c41...a8   (received before the cast)
  server_seed  = 71e0bd...3c   (revealed after the cast)
  cast_id      = 3f2b9c1e-...-7a41
  entropy_i    = one per line (sent by your browser), i = 0 to 5

check 1:  SHA256(server_seed)  -> 9f2c41...a8   matches
check 2:  for each line i:
            HMAC-SHA256(server_seed, cast_id:i:entropy_i)
            -> coins: bytes 0-2 / yarrow: byte 0 % 16 -> line
          derived lines  : 7 8 9 8 8 7
          reported lines : 7 8 9 8 8 7   matches

Every cast keeps these values for as long as the cast itself is kept, and its verify page recomputes both checks for you and prints the recipe it follows, byte by byte — but the point is that you do not need our page. Any implementation of SHA-256 and HMAC, in any language, on any machine, reaches the same answer.

Why this matters for digital ritual

There is a quiet philosophical point underneath the engineering. Divination traditions have always been careful about the integrity of the aleatory moment — the yarrow stalks counted in silence, coins cast in view. The randomness is the ritual's guarantee that the symbol arrived from outside your intentions, which is precisely what makes it useful as a mirror: it shows you something you did not choose to see. For the fuller picture of how a cast becomes a reflection — primary hexagram, changing lines, derived hexagram — see our guide to changing lines.

A digital oracle that could be steered, even benevolently, would break that guarantee in the worst way: invisibly. Commit–reveal restores the visible dice. It also, notably, protects the platform from itself — no future product pressure can quietly tilt the casts toward "more engaging" figures, because every cast is an auditable record and any deviation would surface as a hash mismatch.

None of this makes the oracle wise, and it is not meant to. Cryptography cannot make a hexagram true; no such thing was on offer anyway. What it can do is make the cast clean — provably untouched between your question and your answer — so that whatever you find in the reading, you found by reflecting, not by being managed.

Cast one, then check it

The best way to understand a commit–reveal cast is to run one and then audit it. Ask a real question at the Six Doors casting page, note the commit hash before your first line, and after your reading open the verify page and watch both checks pass. It takes a minute, and it changes the texture of every digital cast afterward: not trust, but something better — the absence of any need for it.