Java Utililty Methods Murmur Hash

List of utility methods to do Murmur Hash

Description

The list of methods to do Murmur Hash are organized into topic(s).

Method

intmurmur(String str, int seed)
murmur
if (str == null)
    throw new IllegalArgumentException("str cannot be null");
final int m = 0xc6a4a793;
final int r = 16;
int hash = seed ^ (str.length() * m);
byte b[] = str.getBytes();
int len = b.length;
int i = 0;
...
intmurmur2(final byte[] data)
murmur
int length = data.length;
int seed = 0x9747b28c;
final int m = 0x5bd1e995;
final int r = 24;
int h = seed ^ length;
int length4 = length / 4;
for (int i = 0; i < length4; i++) {
    final int i4 = i * 4;
...
intmurmur2(int value, int salt)
The Murmur2 hash function.
final int M = 0x5bd1e995;
final int R = 24;
int hash = salt;
value *= M;
value ^= value >>> R;
value *= M;
hash *= M;
hash ^= value;
...
intmurmur3fmix(int value)
The Murmur3 Fmix function.
value ^= value >>> 16;
value *= 0x85ebca6b;
value ^= value >>> 13;
value *= 0xc2b2ae35;
value ^= value >>> 16;
return value;
intmurmurHash(byte[] data, int offset, int length)
murmur Hash
int m = 0x5bd1e995;
int r = 24;
int h = length;
int len_4 = length >> 2;
for (int i = 0; i < len_4; i++) {
    int i_4 = offset + (i << 2);
    int k = data[i_4 + 3];
    k = k << 8;
...
intmurmurHash(int code)
murmur Hash
code *= 0xcc9e2d51;
code = Integer.rotateLeft(code, 15);
code *= 0x1b873593;
code = Integer.rotateLeft(code, 13);
code *= 0xe6546b64;
code ^= 4;
code ^= code >>> 16;
code *= 0x85ebca6b;
...
longmurmurhash2_64(final byte[] data, int length, int seed)
murmur hash 2.0, The murmur hash is a relatively fast hash function from http://murmurhash.googlepages.com/ for platforms with efficient multiplication.
final long m = 0xc6a4a7935bd1e995L;
final int r = 47;
long h = (seed & 0xffffffffl) ^ (length * m);
int length8 = length / 8;
for (int i = 0; i < length8; i++) {
    final int i8 = i * 8;
    long k = ((long) data[i8 + 0] & 0xff) 
            + (((long) data[i8 + 1] & 0xff) << 8) 
...
intmurmurHash3(int k)
murmur Hash
k ^= k >>> 16;
k *= 0x85ebca6b;
k ^= k >>> 13;
k *= 0xc2b2ae35;
k ^= k >>> 16;
return k;
intmurmurHash3(int x)
Avalanches the bits of an integer by applying the finalisation step of MurmurHash3.
x ^= x >>> 16;
x *= 0x85ebca6b;
x ^= x >>> 13;
x *= 0xc2b2ae35;
x ^= x >>> 16;
return x;
intmurmurHash3(int x)
murmur Hash
x ^= x >>> 16;
x *= -2048144789;
x ^= x >>> 13;
x *= -1028477387;
x ^= x >>> 16;
return x;