Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Probability of SHA1 collisions

Given a set of 100 different strings of equal length, how can you quantify the probability that a SHA1 digest collision for the strings is unlikely... ?

like image 340
eastafri Avatar asked Dec 08 '09 14:12

eastafri


People also ask

Does SHA-1 have collisions?

SHA-1 collision attacks In a cryptographic hash function, collisions should in theory be not significantly faster to find than in a brute force attack. Such a brute-force attack is based on the birthday paradox, and it would require expected 2^80 computations to produce a SHA-1 collision.

Is SHA-1 collision-resistant?

While the SHA1 collision is definitive proof that the algorithm can be compromised, it still took Google and CWI's researchers a massive amount of computing power (nine quintillion SHA1 or 6,500 CPU and 110 GPU years' worth of computations) despite all the technology available to them.

How likely is a SHA256 collision?

SHA256: The slowest, usually 60% slower than md5, and the longest generated hash (32 bytes). The probability of just two hashes accidentally colliding is approximately: 4.3*10-60.

What is the probability of collision?

The collision probability is defined as the probability that the miss distance between two objects is less than the sum of their safety-radii. Each object's positional uncertainties are combined and their radii summed at the point of closest approach.


2 Answers

alt text

Are the 160 bit hash values generated by SHA-1 large enough to ensure the fingerprint of every block is unique? Assuming random hash values with a uniform distribution, a collection of n different data blocks and a hash function that generates b bits, the probability p that there will be one or more collisions is bounded by the number of pairs of blocks multiplied by the probability that a given pair will collide.

(source : http://bitcache.org/faq/hash-collision-probabilities)

like image 157
Peter Avatar answered Sep 23 '22 01:09

Peter


Well, the probability of a collision would be:

1 - ((2^160 - 1) / 2^160) * ((2^160 - 2) / 2^160) * ... * ((2^160 - 99) / 2^160)

Think of the probability of a collision of 2 items in a space of 10. The first item is unique with probability 100%. The second is unique with probability 9/10. So the probability of both being unique is 100% * 90%, and the probability of a collision is:

1 - (100% * 90%), or 1 - ((10 - 0) / 10) * ((10 - 1) / 10), or 1 - ((10 - 1) / 10)

It's pretty unlikely. You'd have to have many more strings for it to be a remote possibility.

Take a look at the table on this page on Wikipedia; just interpolate between the rows for 128 bits and 256 bits.

like image 42
Anthony Mills Avatar answered Sep 21 '22 01:09

Anthony Mills