Java Utililty Methods FNV Hash

List of utility methods to do FNV Hash

Description

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

Method

intFNVHash(byte[] data)
FNV Hash
int hash = (int) 2166136261L;
for (byte b : data)
    hash = (hash * 16777619) ^ b;
if (M_SHIFT == 0)
    return hash;
return (hash ^ (hash >> M_SHIFT)) & M_MASK;
intFNVHash(byte[] data)
FNV Hash
final int p = 16777619;
int hash = (int) 2166136261L;
for (byte b : data)
    hash = (hash ^ b) * p;
hash += hash << 13;
hash ^= hash >> 7;
hash += hash << 3;
hash ^= hash >> 17;
...
intfnvHash(int[] p)
fnv Hash
long h = 2166136261L;
for (int pi : p)
    h = (h * 16777619L) ^ (long) pi;
return (int) h;
longFNVHash(String str)
FNV Hash
long fnv_prime = 0x811C9DC5;
long hash = 0;
for (int i = 0; i < str.length(); i++) {
    hash *= fnv_prime;
    hash ^= str.charAt(i);
return hash;
intFNVHash1(byte[] data)
FNV Hash
final int p = 16777619;
int hash = (int) 2166136261L;
for (byte b : data)
    hash = (hash ^ b) * p;
hash += hash << 13;
hash ^= hash >> 7;
hash += hash << 3;
hash ^= hash >> 17;
...
longFNVhash64(long val)
FN Vhash
long hashval = FNV_offset_basis_64;
for (int i = 0; i < 8; i++) {
    long octet = val & 0x00ff;
    val = val >> 8;
    hashval = hashval ^ octet;
    hashval = hashval * FNV_prime_64;
return Math.abs(hashval);
...