This is a Java implementation of the Murmur hash 2.0, a relatively fast hash function for architectures with efficient multiplication. Both 32bit and 64bit version are implemented with corresponding jUnit tests. The interface is straightforward:
public final class MurmurHash {
public static int hash32( final byte[] data, int length);
public static long hash64( final byte[] data, int length);
public static int hash32( final byte[] data, int length, int seed);
public static long hash64( final byte[] data, int length, int seed);
public static int hash32( final String text);
public static long hash64( final String text);
public static int hash32( final String text, int from, int length);
public static long hash64( final String text, int from, int length);
}
Download: MurmurHash.java,
MurmurHashTest.java
The code is public domain. Should you change or improve it, please let me know so I can update it. Thanks.