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.

有帮助吗?

解决方案

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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top