liveBook · Manning

Birthday paradox

As explained in Hacking Cryptography

A probability phenomenon in which collisions among samples from a finite set become likely after substantially fewer samples than the set size suggests.

The birthday paradox explains why collisions in a finite output space appear sooner than intuition suggests. With 365 possible birthdays, only 23 people create a greater-than-50% chance that two share a birthday. section 6.2

Hash functions must map unbounded inputs to fixed-size outputs, so collisions are unavoidable in principle. For an ideal N-bit hash, roughly 2^(N/2) computations give an attacker a greater-than-50% chance of finding some collision. section 6.2 section 6.5

The birthday bound changes how hash security properties should be interpreted:

  • Finding any two inputs with the same digest is a collision attack; matching a predetermined digest requires substantially more work and is a second-preimage attack. section 6.2
  • A 128-bit MD5 digest would offer an idealized 2^64-step birthday bound, although practical attacks reduced collision-finding work to about 2^18 steps. section 6.2
  • A hash is considered broken when collisions can be found more efficiently than the naive birthday attack. section 6.5

Different files, identical digest

A collision attack can produce two PDFs with radically different displayed contents but the same hash digest by exploiting format-specific file internals. section 6.5

Figure 6.4 Security properties of hash functions
figure

Use the figure to compare collision resistance with the other security properties of hash functions. section 6.2

How Hacking Cryptography covers it

How deep it goes
Quantifies the birthday bound, contrasts attack goals, and stops short of deriving the probability formula.
Examples
Uses shared birthdays, ideal N-bit hashes, MD5, and colliding PDF files as concrete examples.
What it assumes
Assumes hash-function context while establishing collisions through the pigeonhole principle and birthday example.
What you can do after
Evaluate hash collision security by comparing observed attack effort with the birthday bound.
How it connects
Connects hash functions with the pigeonhole principle, collision resistance, second-preimage resistance, and collision attacks.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Hacking Cryptography. The section links point to the parts of the book it draws on.