abstract class AbstractCompositeHashFunction extends AbstractStreamingHashFunction
Hasher
objects of the delegate hash functions, and in the end, they are used by
makeHash(Hasher[]) that constructs the final HashCode
.AbstractStreamingHashFunction.AbstractStreamingHasher
Modifier and Type | Field and Description |
---|---|
(package private) HashFunction[] |
functions |
private static long |
serialVersionUID |
Constructor and Description |
---|
AbstractCompositeHashFunction(HashFunction... functions) |
Modifier and Type | Method and Description |
---|---|
(package private) abstract HashCode |
makeHash(Hasher[] hashers)
Constructs a
HashCode from the Hasher objects of the functions. |
Hasher |
newHasher()
Begins a new hash code computation by returning an initialized, stateful
Hasher instance that is ready to receive data. |
hashBytes, hashBytes, hashInt, hashLong, hashObject, hashString, hashUnencodedChars, newHasher
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
bits
final HashFunction[] functions
private static final long serialVersionUID
AbstractCompositeHashFunction(HashFunction... functions)
abstract HashCode makeHash(Hasher[] hashers)
HashCode
from the Hasher
objects of the functions. Each of them
has consumed the entire input and they are ready to output a HashCode
. The order of the
hashers are the same order as the functions given to the constructor.public Hasher newHasher()
HashFunction
Hasher
instance that is ready to receive data. Example:
HashFunction hf = Hashing.md5();
HashCode hc = hf.newHasher()
.putLong(id)
.putBoolean(isActive)
.hash();