>>2
by relatively big I mean a few kb. And it is not for a hash table, I will use the hashed value to quickly compare two data with each other.
Name:
Anonymous2011-12-04 13:07
long long hash(char *b)
{
long long hash = 0;
int l = strlen(b);
for(;l>=0;--l)
hash = b[l] + h << 5;
h ^= (h >> 20) ^ (h >> 12);
return h ^ (h >> 7) ^ (h >> 4)
}
MD5 is relatively fast, and can be used if you don't need any security. If you do need cryptographic collision resistance, you want SHA-256.
There's much faster hash algorithms, but the ones I can think of at the top of my head are all intended for hash tables and the like, and 32-bit integers are too small for collision resistance, which means you have to double check any positive match.
If 32-bit is enough for you, just use CRC32. It's widely supported, and has hardware acceleration on new Intel CPUs