I can\'t use boost:hash because I have to stick with C and can\'t use C++.
But, I need to hash a large number (10K to 100k) of tokens strings (5 to 40 bytes length) so t
xxhash is quite fast and easy option. A simple code would use XXH32
function:
unsigned int XXH32 (const void* input, int len, unsigned int seed);
It is 32 bit hash. Since len
is int
, for larger data more than 2^31-1
bytes use these:
void* XXH32_init (unsigned int seed);
XXH_errorcode XXH32_update (void* state, const void* input, int len);
unsigned int XXH32_digest (void* state);