People arrive one at a time and each is assigned a random "bucket" — a day of the
year, or, more generally, one of N equally likely slots. Every arrival
flies to its bucket's pillar on the ring. The moment two people land on the same
pillar, that pillar flashes red: a collision. The surprising part is how few arrivals
it usually takes.
N buckets, the probability that n people include no
collision is ∏(1 − i/N) for i = 0…n−1. Collision probability
is one minus that product — it grows far faster than intuition predicts because it
compares every pair, not just each new person against one fixed target.N = 365, a 50% chance of a shared birthday needs only 23 people,
and 99% needs just 70 — nowhere near 183.√(πN/2) ≈ 1.25√N, plotted live against the empirical average of completed
trials.n-bit output behaves like N = 2ⁿ buckets, so a
"birthday attack" can find two colliding digests in roughly √(2ⁿ) tries
instead of the 2ⁿ tries brute force would need — why hash outputs must be
twice as long as the desired security level.MD5 (128-bit) and SHA-1 (160-bit) were both broken via birthday-style collision attacks, which is why modern protocols require at least 256-bit hash outputs to keep the birthday bound comfortably out of reach.
People arrive one by one and are assigned a random bucket on a ring — a day of the year, or a hash digest slot. Watch how quickly two arrivals land in the same bucket, and see the live probability curve explain why.
Collision probability grows with the number of pairs, not the number of people, so it rises far faster than intuition suggests — the same combinatorics that lets birthday-style attacks break undersized cryptographic hashes.
Pick a preset (birthdays or a hash bit-width) or drag the bucket-count slider directly. Watch pillars fill and flash red on collision, then track the running average trial length against the √(πN/2) theoretical estimate.
With only 23 people in a room there's already a 50% chance two share a birthday — and the same math means a 128-bit hash only offers about 64 bits of real collision resistance.