Good Hash Function for Strings

Posted by Leif Andersen on Stack Overflow See other posts from Stack Overflow or by Leif Andersen
Published on 2010-04-12T17:57:25Z Indexed on 2010/04/12 18:02 UTC
Read the original article Hit count: 341

Filed under:
|
|

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.

© Stack Overflow or respective owner

Related posts about hash

Related posts about hashtable