Is there more chance having collisions between GUID's or a SHA1 hashes of GUID's?

时光怂恿深爱的人放手 提交于 2019-12-10 20:12:07

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/14861313/is-there-more-chance-having-collisions-between-guids-or-a-sha1-hashes-of-guids

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!