🔐 Cryptographic Hash Functions: Avalanche Effect and Collisions
A 3D bit-grid where flipping one input bit shows roughly half the output hash bits flip, alongside a birthday-bound collision simulator dropping hashed values into buckets.
Flip a single bit in a 3D input word and watch a toy hash function scramble roughly half the output bits — then switch to a birthday-bound collision simulator that drops random hashes into buckets until two land in the same one.
🔬 What It Demonstrates
The avalanche grid shows how a well-mixed hash makes single-bit input changes look like a completely new, unrelated output. The collision grid shows why a hash's output space needs to be far larger than its expected number of uses — collisions arrive around √(π/2 · N) insertions, not N.
🎮 How to Use
In Avalanche mode, pick a bit and hit "Flip that bit" to see which output cubes change. In Collisions mode, watch random values fall into buckets automatically — a red flash marks a collision, and the run resets so you can compare trial lengths against the theoretical estimate.
💡 Did You Know?
This square-root scaling — the "birthday bound" — is why a hash digest needs roughly twice as many bits as its stated security level; a 128-bit collision-resistant hash needs about 256 output bits.
Interactive 3D bit-grid where flipping a single input bit shows how a cryptographic hash's output bits cascade and scramble via the avalanche effect.
3D · Three.js / WebGL renderer · 60 FPS target · runs fully client-side, no install