Java FNV Hash FNVHash(String str)

Here you can find the source of FNVHash(String str)

Description

FNV Hash

License

Apache License

Declaration

public static long FNVHash(String str) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    public static long FNVHash(String str) {
        long fnv_prime = 0x811C9DC5;
        long hash = 0;
        for (int i = 0; i < str.length(); i++) {
            hash *= fnv_prime;/*from ww w  .  j  a v a2s . c o  m*/
            hash ^= str.charAt(i);
        }
        return hash;
    }
}

Related

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