开发者

Most effective substring of an MD5 checksum

开发者 https://www.devze.com 2023-02-08 21:41 出处:网络
If I want a shorter MD5 checksum, should I take the regular one and use the first half or the second half? Or does it even matter?

If I want a shorter MD5 checksum, should I take the regular one and use the first half or the second half? Or does it even matter?

(obviously it would cease to be an MD5, it would just b开发者_运维技巧e a checksum)


It doesn't matter, but I'd think very hard about doing this: you'll greatly increase the chance of a collision (two different bits of data with the same checksum).


Use some sort of a CNC hashing function if you need a short string. Be aware that it isn't a very safe, but it will be still better than taking the half of a MD5.


It shouldn't matter. Generally speaking the entire checksum changes for each input byte. But if you can't decide, why not xor the first half with the second? :-)

0

精彩评论

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

关注公众号