Class MurmurHash
java.lang.Object
cn.net.pap.common.datastructure.frequency.MurmurHash
This is a very fast, non-cryptographic hash suitable for general hash-based
lookup. See http://murmurhash.googlepages.com/ for more details.
The C version of MurmurHash 2.0 found at that site was ported to Java by Andrzej Bialecki (ab at getopt org).
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic inthash(byte[] data) static inthash(byte[] data, int seed) static inthash(byte[] data, int length, int seed) static intstatic longhash64(byte[] data, int length) Generates 64 bit hash from byte array with default seed value.static longhash64(byte[] data, int length, int seed) Generates 64 bit hash from byte array of the given length and seed.static longstatic inthashLong(long data)
-
Constructor Details
-
MurmurHash
public MurmurHash()
-
-
Method Details
-
hash
-
hash
public static int hash(byte[] data) -
hash
public static int hash(byte[] data, int seed) -
hash
public static int hash(byte[] data, int length, int seed) -
hashLong
public static int hashLong(long data) -
hash64
-
hash64
public static long hash64(byte[] data, int length) Generates 64 bit hash from byte array with default seed value.- Parameters:
data- byte array to hashlength- length of the array to hash- Returns:
- 64 bit hash of the given string
-
hash64
public static long hash64(byte[] data, int length, int seed) Generates 64 bit hash from byte array of the given length and seed.- Parameters:
data- byte array to hashlength- length of the array to hashseed- initial seed value- Returns:
- 64 bit hash of the given array
-