I don’t think I will have to face hashing algorithms directly as I expect libraries/servers that I’m going to use will provide the best one from their perspective, however, just curious how things are going and also to practice consistent hashing, I wrote a simple perl script.
The result is pretty interesting, I know I cannot cover all test cases, but from various tests I learned:
- FNV is really a bad candidate for hashing … fnv-1 is worse than fnv-1a
- CRC32 is not good as expected
- SHA1 provides acceptable result
- MD5 is doing pretty good
Performance wise – CRC32 is the winner, MD5 is ~20% slower, SHA1 is ~33% slower. I cannot tell performance of FNV as it is a pure perl implementation while others are Perl module which means results are from C/C++ codes.
This could be my last “research” on consistent hashing, I’m going to move to deployment and try out all those NoSQL solutions.