Java FNV Hash FNVHash(byte[] data)

Here you can find the source of FNVHash(byte[] data)

Description

FNV Hash

License

Open Source License

Declaration

public static int FNVHash(byte[] data) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static int FNVHash(byte[] data) {
        final int p = 16777619;
        int hash = (int) 2166136261L;
        for (byte b : data)
            hash = (hash ^ b) * p;//  w  ww  .j  a  v a2s .  c om
        hash += hash << 13;
        hash ^= hash >> 7;
        hash += hash << 3;
        hash ^= hash >> 17;
        hash += hash << 5;
        return hash;
    }
}

Related

  1. FNVHash(byte[] data)
  2. fnvHash(int[] p)
  3. FNVHash(String str)
  4. FNVHash1(byte[] data)
  5. FNVhash64(long val)