In this track: Cryptography with intuition
advanced · 4 MIN READ

Commit and reveal patterns

Commit to a choice before exposing the choice and salt.

LET’S PICTURE IT

Seal a decision in an envelope, then open it after everyone has committed.

SEE IT FOR YOURSELF
From exact bytes to a Keccak-256 fingerprintStep 1 / 4
From exact bytes to a Keccak-256 fingerprintUTF-8 texthelloExact spelling mattersA hash commits to bytes, not a visual interpretationFive input bytes68656c6c6fLiteral text 0x68656c6c6f would be a different text inputInput bytes68 65 6c 6c 6f5 bytesKeccak-256Deterministic calculation32-byte resultUse Keccak-256, not an interchangeable SHA3-256 assumption0x1c8aff95…36deac8Fixed output: 32 bytesSame input bytes → same outputA fingerprint does not prove that the input is truthful or safe

The text hello is a particular sequence of characters. Case or text normalization can change the encoded bytes.

Animated local teaching model. No wallet, RPC or live blockchain data. Some labels and hashes are abbreviated for readability.

Commit to exact content

A commitment hashes an unambiguous encoding of the choice, unpredictable salt and relevant context. The verifier later recomputes that same digest.

Keep the salt unpredictable

If choices come from a small set and the salt is absent or guessable, observers can try every candidate before the reveal stage.

Define timing and non-reveal behavior

A protocol needs rules for commitment deadlines, reveal windows and participants who never reveal. Hashing alone does not solve withholding or fairness problems.

Bind the intended participant

Include relevant identity or action context so another party cannot copy a commitment or reveal into an unintended role. The exact fields depend on the protocol.

Inspect the distinction

commit = H(typed context, participant, choice, unpredictable salt)
reveal → recompute and compare

Timing, non-reveal rules and replay protection remain application responsibilities.

These are local teaching values, not a signature request or a live-chain lookup.

TURN UNDERSTANDING INTO PRACTICEOpen the Keccak-256 →
QUICK CHECK · NO PRESSURE

Does hashing one of two choices without a secret salt hide it well?

Your progress stays in this browser.
Keep exploring the original referenceSolidity documentation ↗

Original explanations by EtherTools. Examples are educational and source-linked; this site is independent of the Ethereum Foundation. Our approach.