The Cheating Problem
Alice and Bob want to play “guess the coin flip” over the phone:
- Alice flips a coin
- Bob guesses heads or tails
- Alice reveals the result
The problem: Alice can cheat. After hearing Bob’s guess, she can simply lie about what she flipped.
We need a way for Alice to lock in her answer before Bob guesses, without revealing it yet.
The Sealed Envelope
Think of a commitment like a sealed envelope:
- Alice writes her answer on paper
- She seals it in an envelope
- She hands the sealed envelope to Bob
- Bob makes his guess
- Alice opens the envelope to reveal the answer
Why this works:
- Bob can’t peek inside the sealed envelope
- Alice can’t swap the contents after handing it over
The envelope is both opaque and tamper-evident.
Two Phases
Every commitment scheme has two phases:
| Phase | What happens |
|---|---|
| Commit | Lock in a value without revealing it |
| Reveal | Open the commitment, prove what was inside |
The commit phase produces a commitment (the sealed envelope). The reveal phase opens it.
Two Properties
A secure commitment scheme guarantees two things:
Hiding: The commitment reveals nothing about the value.
Before the reveal phase, the receiver learns zero information about what’s inside.
Binding: The committer cannot change the value after committing.
Once committed, the sender is bound to that value. No take-backs.
Both properties are essential. Without hiding, the receiver peeks. Without binding, the sender cheats.
Building Commitments from Hashes
The simplest construction uses a hash function.
To commit to message :
- Pick a random value (called a nonce)
- Compute
- Send to the receiver
The symbol denotes concatenation.
To reveal:
- Send and to the receiver
- Receiver computes
- If it matches , the commitment is valid
The commitment is just a hash. Short, fixed-size, reveals nothing.
Why It’s Hiding
Hash functions are one-way. Given , you can’t work backwards to find .
But there’s a subtlety. What if is just “heads” or “tails”?
Without the random , the receiver could just compute and , compare to , and know the answer immediately.
The nonce prevents this. Even if there are only two possible messages, each commitment looks completely random.
The randomness makes commitments to the same message look different every time.
Why It’s Binding
To cheat, Alice would need to find and such that:
where .
This is a hash collision. For secure hash functions, finding collisions is computationally infeasible.
Binding relies on collision resistance. If you can’t find collisions, you can’t change your commitment.
The Full Protocol
Setup: Alice and Bob agree on a hash function .
Commit phase:
- Alice has secret value
- Alice generates random nonce
- Alice computes
- Alice sends to Bob
Reveal phase:
- Alice sends to Bob
- Bob computes
- Bob checks: does it equal ?
- If yes, accept as the committed value
Applications
Commitments appear throughout cryptography:
| Application | How commitments help |
|---|---|
| Sealed-bid auctions | All bidders commit first, then reveal simultaneously |
| Zero-knowledge proofs | Prover commits to values before verifier’s challenge |
| Electronic voting | Commit to votes, reveal only after polls close |
Anywhere you need “I’ll tell you later, but I’m locking in my answer now”, that’s a commitment scheme.
Key Insight
Commitments separate when you decide from when you reveal.
This simple primitive enables fair protocols between parties who don’t trust each other. Alice can’t cheat because she’s bound. Bob can’t cheat because he can’t peek.
A commitment is a cryptographic promise. The math ensures you keep it.