Question

Is there more chance having collisions when betweens GUID's (128 bits) or SHA1 hashes of GUID's (160 bits) ? My opinion is there is less chance with a GUID (even if there is 32 bit less), because it has some special mechanisms to make sure it is (almost, because no guarantee) unique (ex : timestamp)

Note : i already know that a GUID is very unlikely to have a collision with another GUID, no more debate about this please.

Was it helpful?

Solution

That's trivial: if two GUIDs are the same (that is, for each GUID collision), their hashes are also the same (we have a "collision" which is not a "SHA1 collision", but it's bad enough for our application). Plus there is a probability of a hash collision proper (same SHA1 for different GUIDs).

You can only add collisions if you hash your GUIDs.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top