views:

1423

answers:

1

I just found out murmur hash, seems to be the fastest known and quite collision resistance. I tried to dig more about the algorithm or implementation in full source code, but I am having difficulty understanding it. Could someone here explain the algorithm used, or implement it in full source code, preferably in C. I read the C source code from the author website but has no idea, like: what is seed, h, k, m ? what does this mean :

k *= m; 
k ^= k >> r; 
k *= m; 

h *= m; 
h ^= k;

data += 4;
len -= 4;

???

Reference : http://murmurhash.googlepages.com/

Sorry for my English and my stupidity. Cheers

+1  A: 

Hi,

The code is available here . m and r are constants used by the algorithm. k *= m means take variable k and multiple it by m. k ^= k >> r means take k and right shift the bits r places (e.g. if r is 2 110101 would become 001101) and then XOR it with k.

Hope that gives you enough to work through the rest.

Regards

Howard May