Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Good hash algorithm for list of (memory) addresses

Tags:

algorithm

hash

I have a list of (64-bit) addresses that represent a stack frame, and I want to hash these to a single 64-bit number to help identify those that have been seen before. There are at most 128 addresses.

My current algorithm calculates the hash by iterating through the list, xor'ing each address into the hash and rotating the hash by 11 bits per cycle.

Any better suggestions?

like image 399
Rob Walker Avatar asked Dec 22 '08 17:12

Rob Walker


2 Answers

You might consider some sort of CRC.

Perhaps a CRC64.

like image 162
EvilTeach Avatar answered Oct 24 '22 14:10

EvilTeach


There are a couple of nice integer hash functions here, for both 32 and 64 bit: http://www.concentric.net/~Ttwang/tech/inthash.htm

Also there's some written on it here: http://burtleburtle.net/bob/hash/evahash.html

like image 45
Filip Ekberg Avatar answered Oct 24 '22 13:10

Filip Ekberg