views:

53

answers:

1

Embarrassingly, picking a hash function (say, for hashing strings, or sets of integers, etc.) is still magic to me: take some prime numbers here, magic constants there, do some bit shifting, modulo something, and done.

Is there a nice, gentle and approachable tutorial about creating hash functions?

+1  A: 

You can find a decent, easy hash tutorial at Hash Table Tutorial (discusses hash functions as well). Note that if you do a web search, you can find a lot of good information.

Wikipedia has some basic info on both Hash Tables and Hash Functions.

EDIT

A similar question was previously asked: Which Hash Function Should I Choose. The question and answers are excellent.

Edward Leno
the question was about the hash function, not a hash table.
codymanix
Thanks @codymanix, I added an edit to avoid any confusion.
Edward Leno
The Wikipedia Hash Function page is far from being a nice tutorial.
Frank