hashcryptographysha1shahash-collision

What is the maximum number of SHA-1 hashes?


Clearly since SHA-1 hashing produces 40 characters each time, there is a finite number of possible hashes—does anyone know exactly how many?


Solution

  • SHA-1 hashes have 160 bits, so 2160 of them.
    (2160 = 1461501637330902918203684832716283019655932542976 ~= 1.46 x 1048)

    Note that since you have a much larger message space than possible hashes, collisions are bound to occur.

    Also note that the probability of collision is much higher than you might think. At just 280 messages the probability of a collision is 50%, thanks to the Birthday paradox. (ie: with just 23 people the probability that 2 people have the same birthday is 50%).