I'm looking for an efficient hash algorithm with which I can have 64-bit values represent strings in a databse.
Following Mark Adler's answer+comments here it seems that using a cryptographical hash function is an overkill. Mark has recommended to try Java's hashCode, but I need a C++ library. I thought about using boost::hash_range.
My question is: Does anyone know how is the distribution of this function vs. Java's hashCode? It would be nice if someone has something to say about about boost::hash_range's performance as well :)
hashCode
, buthash_range
combines the range values using the following algorithm:seed ^= hash(value) + 0x9e3779b9 + (seed<<6) + (seed>>2);
- whereseed
is accumulating the hash result (initially zero). – Igor R. Apr 2 at 14:35boost::hash_range
's performance or distribution. – Useless Apr 2 at 15:02