Most effective substring of an MD5 checksum
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? :-)
精彩评论