In a room of just 23 people, two share a birthday more likely than not — because what matters is the number of pairs, which grows as the square. The same “birthday paradox” governs hash collisions: among a space of N possible outputs, you expect a collision after only about √N random items, not N. That is why a hash needs double the bits you want in security: a 256-bit hash gives only 128-bit collision resistance. The birthday bound is the attacker’s square-root shortcut, and it sets the size of every digest.
The demo hashes 1,2,3,… into 16 buckets and reports the first collision — it lands at 4 ≈ √16, far below 16: live demo
“A collision needs about N tries for N outputs.” — only √N: pairs grow quadratically, so collisions arrive at the square root. cited
Collisions arriving at the square root of the space — the paradox that halves every hash’s effective strength. theorem
On the canonical compiler, hashing 1,2,3,… into 16 buckets, the first collision occurs at the 4th item — right at √16: