6 Hashfunctions
6 Hashfunctions
6 Hashfunctions
Applied Cryptography
Nadia Heninger
UCSD
1. HW 2 is due today!
Definition
H is collision-resistant if Pr[A succeeds] ≤ negligible.
Practical hash functions
1. Collision resistance:
Find m0 , m1 such that H(m0 ) = H(m1 ).
3. Preimage resistance:
Input t = H(m0 ), find m1 s.t. H(m1 ) = t.
Generic collision-finding attacks on hash functions
Theorem
√
Pr[collision after Θ( N) inputs] ≥ 1/2
Birthday collision theorem
Theorem
√
Pr[collision after Θ( N) inputs] ≥ 1/2
Proof.
We throw k balls uniformly at random into N distinct bins.
1 2 k −1
Pr[k balls into N distinct bins] = 1·(1− )·(1− ) . . . (1− )
N N N
1
Use 1 − N ⪅ e −1/N .
k−1
Y Pk−1
Pr[distinct] ≤ e −i/N = e −1/N i=1 i
= e −k(k−1)/2N
i=1
√
For k = N:
2 /2N
Pr[collision] = 1 − Pr[distinct] ≥ 1 − e k ≥ 1 − e −2 ≥ 1/2
Birthday Attack Algorithm Complexity
√
Algorithm time: O( N)
Memory: O(1)
Conclusion: CBC mode on its own does not lead to a secure hash
function.
Merkle-Damgård Construction
This is collision-resistant.