Collision resistance
From Wikipedia, the free encyclopedia
Collision resistance is a property of cryptographic hash functions: a hash function is collision resistant if it is hard to find two inputs that hash to the same output. In other words, consider a function f(x) which generates the same result y for separate inputs a and b. That is, f(a) = y = f(b). It is then said that f(x) produces a hash collision. Collision resistance attempts to prevent an attacker from easily finding such collisions.
Every hash function with more inputs than outputs will necessarily have collisions. Consider a hash function such as SHA256 that produces 256 bits of output from an arbitrarily large input. Since it must generate one of 2256 outputs for each member of a much larger set of inputs, the pigeonhole principle guarantees that some inputs will hash to the same output. Collision resistance doesn't mean that no collisions exist; simply that they are hard to find.
The birthday "paradox" places an upper bound on collision resistance: if a hash function produces N bits of output, an attacker can find a collision (on average) by performing "only" 2N / 2 hash operations until two outputs happen to match. If there is an easier method than this brute force attack, it is typically considered a flaw in the hash function.
Cryptographic hash functions in general use today are designed to be collision resistant, but none is absolutely so. MD5 and SHA-1 in particular both have published techniques simpler than brute force for finding collisions.
[edit] Rationale
Collision resistance is desirable for several reasons.
- In some digital signature systems, a party attests to a document by publishing a public key signature on a hash of the document. If it is possible to produce two documents with the same hash, an attacker could get a party to attest to one, and then claim that the party had attested to the other.
- In some proof-of-work systems, users provide hash collisions as proof that they have performed a certain amount of computation to find them. If there is an easier way to find collisions than brute force, users can cheat the system.
- In some distributed content systems, parties compare cryptographic hashes of files in order to make sure they have the same version. An attacker who could produce two files with the same hash could trick users into believing they had the same version of a file when they in fact did not.