A collision-resistant hash function makes it computationally infeasible to find two distinct inputs that produce the same digest. The attacker chooses both inputs, unlike second pre-image resistance, where one input is fixed. section 2.2
Keep these practical limits in mind:
- Treat collision resistance as a security property whose value depends on how the hash function is used, not as a guarantee that collisions are mathematically impossible. section 2.3
- Use sufficiently large digests: a two-bit hash makes collisions easy, while practical hash functions require at least 256-bit outputs. section 2.3
- Retire algorithms whose collision resistance has been broken; published collisions made MD5 and SHA-1 unsuitable when collision resistance matters. section 2.5
A small-output warning
Imagine a hash function with only two output bits. Since it has just four possible digests, hashing a few random strings should quickly produce two different inputs with the same output. Larger digests push this search out of practical reach. section 2.3
Figure 2.5 One should never be able to find two inputs (represented on the left as two random blobs of data) that hash to the same output value (on the right). This security property is called collision resistance.
Visualize two independently chosen input blobs converging on one identical digest. section 2.2


