I am looking for two hash functions for hashing strings in Java. Can anyone suggest some functions that are already written in Java for this? I already looked here but I am not sure how to implement them in Java. Thanks.
Asked
Active
Viewed 61 times
0
-
2What's wrong with `String.hashCode`? What requirements do you have that it doesn't meet? – Dawood ibn Kareem Dec 09 '14 at 22:07
-
1If you can use external libraries, go with Guava and its [`Hashing`](http://docs.guava-libraries.googlecode.com/git-history/release/javadoc/com/google/common/hash/Hashing.html) class – fge Dec 09 '14 at 22:07
-
I am looking for other sources that aren't included with java to test on my application. – jdc987 Dec 09 '14 at 22:08
-
1What are you trying to use this hash for? A `HashMap`? A security application? A Bloom filter? It matters. – Louis Wasserman Dec 09 '14 at 22:19
-
1possible duplicate of [Good Hash Function for Strings](http://stackoverflow.com/questions/2624192/good-hash-function-for-strings) – ajb Dec 09 '14 at 22:19
-
Thanks everyone. That "Good Hash Function for Strings" thread was helpful. I ended up going with the DJB function and the Murmur function from here: https://code.google.com/r/sergiobossa-terrastore-kryo/source/browse/src/main/java/terrastore/router/impl/?r=38f6dd91cd36e1c7386e966c1e4c0a8aa909e3a4 – jdc987 Dec 09 '14 at 23:20