← 🖥️ Computer Science

🔐 Hash Avalanche Lab

Avalanche effect
Input:
Output hash:
Bits flipped:
FPS:
Drag — rotate · Scroll — zoom

🔐 Cryptographic Hash Functions: Avalanche Effect and Collisions

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.