In Bishop's Introduction to computer security, on page 118, we see the following:
Definition 8–2. A cryptographic checksum function (also called a strong hash function or a strong one-way function) $h: A → B$ is a function that has the following properties:
- For any $x ∈ A$, $h(x)$ is easy to compute.
- For any $y∈B$,it is computationally infeasible to find $x∈A$ such that $h(x)=y$.
- It is computationally infeasible to find $x, x' ∈ A$, such that $x ≠ x'$ and $h(x) = h(x')$. (Such a pair is called a collision.)
The third requirement is often stated as:
- Given any $x ∈ A$, it is computationally infeasible to find another $x' ∈ A$ such that $x ≠ x'$ and $h(x') = h(x)$.
However, properties 3 and 4 are subtlely different. It is considerably harder to find an $x$ meeting the conditions in property 4 than it is to find a pair $x$ and $x'$ meeting the conditions in property 3. To explain why, we need to examine some basics of cryptographic checksum functions.
Given that the checksum contains fewer bits than the message, several messages must produce the same checksum. The best checksum functions have the same number of messages produce each checksum. Furthermore, given any message, the checksum it produces can be determined only by computing the checksum. Such a checksum function acts as a random function.
The size of the output of the cryptographic checksum is an important consideration owing to a mathematical principle called the pigeonhole principle.
Definition 8–3. The pigeonhole principle states that if there are $n$ containers for $n + 1$ objects, at least one container will hold two objects. To understand its application here, consider a cryptographic checksum function that computes hashes of three bits and a set of files each of which contains five bits. This yields $2^3 = 8$ possible hashes for $2^5 = 32$ files. Hence, at least four different files correspond to the same hash.
Now assume that a cryptographic checksum function computes hashes of 128 bits. The probability of finding a message corresponding to a given hash is $2^{–128}$, but the probability of finding two messages with the same hash (that is, with the value of neither message being constrained) is $2^{–64}$ (see Exercise 20).
How to get the final $2^{-64}$ mathematically?