Good Hash Function for Strings
- by Leif Andersen
I'm trying to think up a good hash function for strings. And I was thinking it might be a good idea to sum up the unicode values for the first five characters in the string (assuming it has five, otherwise stop where it ends). Would that be a good idea, or is it a bad one?
I am doing this in Java, but I wouldn't imagine that would make much of a difference.