3 ms·
SHA-1 has a digest size of 160 bits. The first two bytes of these beautified hashes are predetermined, which lowers the size to 144 bits. For a more than 50% ch
by kmm 15y ago
SHA-1 has a digest size of 160 bits. The first two bytes of these beautified hashes are predetermined, which lowers the size to 144 bits. For a more than 50% chance of a collision, more than 4 sextillion hashes[1] would have to be generated, compared to 1 septillion hashes[2] for the normal digest. A difference of an order of a magnitude, yet absolutely nothing to be worried about. Collisions are vastly more likely to be caused by a stray cosmic ray than actual chance.
[1] 2^(144/2) ~= 7e21
[2] 2^(160/2) ~= 1e24
- vog 15y agoThis is only true if you use the same prefix for all commits. However, the script takes the prefix as argument, which allows you to use prefixed like 0001, 0002, etc. Apart from that, this is a toy project and by no means meant seriously.
- kmm 15y agoI didn't take it seriously of course, I just saw this question and I was myself curious what the chances of a birthday collision actually are.