I just studied Murmur Hash in http://ift.tt/eMiZiP. And the Algorithm is as follows:
Murmur3_32(key, len, seed)
c1 = 0xcc9e2d51
c2 = 0x1b873593
r1 = 15
r2 = 13
m = 5
n = 0xe6546b64
hash =gets seed
for each fourByteChunk of key
k =gets fourByteChunk
k = k * c1
k = (k << r1) OR (k >> (32-r1))
k = k * c2
hash = hash XOR k
hash = (hash << r2) OR (hash >> (32-r2))
hash = hash * m + n
with any remainingBytesInKey
remainingBytes = SwapEndianOrderOf(remainingBytesInKey)
remainingBytes = remainingBytes * c1
remainingBytes = (remainingBytes << r1) OR (remainingBytes >> (32 - r1))
remainingBytes = remainingBytes * c2
hash = hash XOR remainingBytes
hash = hash XOR len
hash = hash XOR (hash >> 16)
hash = hash * 0x85ebca6b
hash = hash XOR (hash >> 13)
hash = hash * 0xc2b2ae35
hash = hash XOR (hash >> 16)
I can generally understand the source code, but I don't know where the number 0xcc9e2d51 come from. I googled the number 0xcc9e2d51, and I found many functions used this number. Is there anyone could tell me?
Aucun commentaire:
Enregistrer un commentaire