On 19/03/2010 22:07, Robert Dewar wrote: > You miss my point, doing a mod with 256 is an AWFUL hash algorithm > since it only uses the low order 8 bits!
This statement is only true contingent on a number of significant assumptions you haven't stated - assumptions which can easily be violated. > I think you will find that people on this mailing list know all about > hash tables I think you should get down from that high horse before you come down with an embarrassing bump. > So this does not get around the possibility of a bad luck worst case. Perfect hashing does exactly that. That's why it's "popular for hashing keywords for compilers", and indeed why it "ought to be popular for optimizing switch statements": http://burtleburtle.net/bob/hash/perfect.html cheers, DaveK