Package redis.clients.jedis.util
Class MurmurHash
- java.lang.Object
-
- redis.clients.jedis.util.MurmurHash
-
- All Implemented Interfaces:
Hashing
public class MurmurHash extends Object implements Hashing
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).
-
-
Field Summary
-
Fields inherited from interface redis.clients.jedis.util.Hashing
MD5, md5Holder, MURMUR_HASH
-
-
Constructor Summary
Constructors Constructor Description MurmurHash()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description long
hash(byte[] key)
static int
hash(byte[] data, int seed)
Hashes bytes in an array.static int
hash(byte[] data, int offset, int length, int seed)
Hashes bytes in part of an array.long
hash(String key)
static int
hash(ByteBuffer buf, int seed)
Hashes the bytes in a buffer from the current position to the limit.static long
hash64A(byte[] data, int seed)
static long
hash64A(byte[] data, int offset, int length, int seed)
static long
hash64A(ByteBuffer buf, int seed)
-
-
-
Method Detail
-
hash
public static int hash(byte[] data, int seed)
Hashes bytes in an array.- Parameters:
data
- The bytes to hash.seed
- The seed for the hash.- Returns:
- The 32 bit hash of the bytes in question.
-
hash
public static int hash(byte[] data, int offset, int length, int seed)
Hashes bytes in part of an array.- Parameters:
data
- The data to hash.offset
- Where to start munging.length
- How many bytes to process.seed
- The seed to start with.- Returns:
- The 32-bit hash of the data in question.
-
hash
public static int hash(ByteBuffer buf, int seed)
Hashes the bytes in a buffer from the current position to the limit.- Parameters:
buf
- The bytes to hash.seed
- The seed for the hash.- Returns:
- The 32 bit murmur hash of the bytes in the buffer.
-
hash64A
public static long hash64A(byte[] data, int seed)
-
hash64A
public static long hash64A(byte[] data, int offset, int length, int seed)
-
hash64A
public static long hash64A(ByteBuffer buf, int seed)
-
-