Here you can find the source of hashBerkeleyDB64(byte[] str)
Parameter | Description |
---|---|
str | Value to be hashed |
public static long hashBerkeleyDB64(byte[] str)
//package com.java2s; //License from project: Open Source License public class Main { /**//from w w w. j ava 2 s .c o m * A hash function used in Berkeley DB * * @param str Value to be hashed * @return the 64bit hash code */ public static long hashBerkeleyDB64(String str) { return hashBerkeleyDB64(str.getBytes()); } /** * A hash function used in Berkeley DB * * @param str Value to be hashed * @return the 64bit hash code */ public static long hashBerkeleyDB64(byte[] str) { long hash = 0; for (int i = 0; i < str.length; i++) { hash = str[i] + (hash << 6) + (hash << 16) - hash; } return hash; } }