Home▸Cybersecurity▸Birthday Attack: Hash Collision Distribution (2D)

Birthday Attack: Hash Collision Distribution (2D)

Interactive 2D birthday-attack simulator: fill a flat grid of hash buckets with random draws and watch the empirical distribution of trials-to-collision, accumulated run after run, converge onto the exact discrete birthday-paradox probability curve — not the 3D sim's continuous approximation.

Cybersecurity2DModerate60 FPS📱 Mobile-adapted⇄ 3D version
2d-cryptographic-hash-collision-birthday-attack ↗ Open standalone

This 2D companion to the 3D birthday-attack simulator drives the same underlying process — dropping random "hash" draws into N uniformly-random buckets until two land in the same one — but computes and displays a genuinely different piece of math. Instead of a rotating 3D cube and a continuous approximation formula, it lays the hash space out as a flat grid and, every time a run finds its collision, records the exact sample count k into a running histogram. That histogram is plotted live against the exact discrete birthday-paradox probability mass function, computed by direct recurrence rather than the usual exponential approximation, so you can watch empirical frequency across dozens of completed attack runs converge onto the closed-form curve in real time. Adjust the bit-width to grow or shrink the hash space and compare how quickly the empirical distribution locks onto the theoretical one at each size.

⚙ Under the hood

Fill a flat 2D grid of hash buckets with random draws and watch the empirical histogram of trials-to-collision, accumulated run after run, converge live onto the exact discrete birthday-paradox probability curve computed by direct recurrence — a genuinely different computation from the 3D sim's continuous approximation formula.

cryptographyhashingbirthday-paradoxcybersecuritycollision-attackprobability-distribution

2D · HTML5 Canvas 2D · 60 FPS target · runs fully client-side, no install

What did you find?

Add reproduction steps (optional)