List of utility methods to do Byte Array Hash
int | hashCode(byte[] data) hash Code if (data == null) { return 0; int i = data.length; int hc = i + 1; while (--i >= 0) { hc *= 257; hc ^= data[i]; ... |
byte[] | hash(String algorithm, byte[] data) returns a hash SHA-1 of the given byte array try { MessageDigest digest = MessageDigest.getInstance(algorithm); return digest.digest(data); } catch (NoSuchAlgorithmException e) { return null; |
int | getByteArrayHash(byte[] value) Calculate the hash code of the given byte array. int len = value.length; int h = len; if (len < 50) { for (int i = 0; i < len; i++) { h = 31 * h + value[i]; } else { int step = len / 16; ... |