开发者

Length of SHA1 hash to identify an object?

Can I create a really short SHA1 hash to uniquely identify an object开发者_运维百科 that would typically have an id like 1300992607?

This is relatively a theoretical question but how short can a SHA1 hash be and still be unique for an objects id? Please help me if not asking the right question here.


No, you can't, a hash doesn't work that way.

You can create a hash for the id, and just take as many bits you like from it. The more bits you use, the less likely it is that you get a hash that is the same for two different id, but no matter how many bits you use from the hash there is still no guarantee that there will never be a collision.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜