http://webkit.org/blog/8/hashtables-part-2/
One of the more important but somewhat mysterious aspects of hashtables is writing hash functions. A hash function needs to take your data (possibly fixed-size, possibly variable-sized) and turn it into a fixed-size number that has “good distribution”. If you manage this, you won’t get a lot of collisions. This means each hash lookup will have to look at only a few buckets in the table and so will be fast.