public final class StreamHasher
extends java.lang.Object
StreamHasher hasher = new StreamHasher();
for (long offset = 0; offset < streamLength; offset += chunkLength) {
hasher.addChunk(offset, chunkOfCharacters);
}
int64 hashValue = hasher.computeHash();
Based on lookup3.c by Bob Jenkins from "http://burtleburtle.net/bob/c/lookup3.c"| Constructor and Description |
|---|
StreamHasher() |
| Modifier and Type | Method and Description |
|---|---|
void |
addChunk(char[] chunk)
Adds a chunk of data to the hasher.
|
long |
computeHash()
Computes and returns the hash value.
|
static long |
hash(java.lang.String str)
Computes a 64-bit hash value of a String.
|
public void addChunk(char[] chunk)
chunk - Contents of the chunk.public long computeHash()
public static long hash(java.lang.String str)
str - The string to hash.