Hash??? What ARE the latest hot-shot methods?

Dan Bernstein brnstnd at kramden.acf.nyu.edu
Wed Dec 5 11:37:28 AEST 1990


In article <1990Dec4.142017.12806 at batcomputer.tn.cornell.edu> lynch at batcomputer.tn.cornell.edu (Tim Lynch) writes:
> Thanks for the reference.  Can someone recommend a book that does go into
> all the latest "hot-shot" methods?

Have there been any fundamentally new hashing methods in the last twenty
years? The only one I know of is Pearson's.

What are you really looking for? There are lots of string functions that
are both fast and, in practice, better than random hashing. These days I
start from h = 5381, and set h = h << 5 + h + c mod any power of 2 for
each new character c. Apparently Chris Torek prefers a multiplier of 31:
h << 5 - h + c. These are reliable and extremely fast. You can make them
even faster if you want to hash an entire string at once: just
precompute powers of 31 or 33, etc.

---Dan



More information about the Comp.lang.c mailing list