Zero-Knowledge Proofs (ZKP) — Interactive Demos

Two ways to understand "proving without revealing": (1) Ali Baba's Cave and (2) Hash Commitment (Commit–Reveal).

Ali Baba's Cave — Controls

Random challenge: A or B
Total Rounds
0
Successes
0
Failures
0
If secret is NOT known, prob. of cheating
Prob. of cheating after k consecutive successes without secret: (1/2)k. E.g.: 10 successes ≈ 0.0977%.

Log

Tip: Run Auto ×5 multiple times with the secret disabled to visualize the exponential drop.
Verifier waiting…
Challenge: —
Round #0
DOOR A
DOOR B
Prover Success Failure

Create Commitment (Commit)

Generate a commitment C = SHA-256(salt || ":" || secret). The commitment can be published; the secret cannot.

The salt prevents dictionary/reuse attacks; publishing salt + C does not reveal the secret.

Verify Knowledge (Reveal without revealing the secret)

The verifier only needs the commitment C and the salt. The prover enters their secret locally; the UI only shows Success/Failure.

Status: —

What's happening?

  • First, you publish the salt and C (the commitment). No one knows the secret.
  • To verify, you enter the secret on your device. The app calculates H(salt || ":" || secret) and compares it with C.
  • The verifier only gets a yes/no (completeness/soundness) without learning the secret (zero-knowledge at a practical UI level).
Note: This models a simple hash commitment. In production, ZKPs allow for formal proofs without revealing inputs or re-running the computation in the clear.
Material created by Professor Sergio Gevatschnaider