java.lang.Object
org.elasticsearch.common.hash.Murmur3Hasher
Wraps
MurmurHash3
to provide an interface similar to MessageDigest
that
allows hashing of byte arrays passed through multiple calls to update(byte[])
. Like
MessageDigest
, this class maintains internal state during the calculation of the
hash and is not threadsafe. If concurrent hashes are to be computed, each must be done on a
separate instance.-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbyte[]
digest()
Completes the hash of all bytes previously passed toupdate(byte[])
.Completes the hash of all bytes previously passed toupdate(byte[])
.Completes the hash of all bytes previously passed toupdate(byte[])
.static String
void
reset()
Clears all bytes previously passed toupdate(byte[])
and prepares for the calculation of a new hash.void
update
(byte[] inputBytes) Supplies some or all of the bytes to be hashed.
-
Field Details
-
METHOD
- See Also:
-
-
Constructor Details
-
Murmur3Hasher
public Murmur3Hasher(long seed)
-
-
Method Details
-
update
public void update(byte[] inputBytes) Supplies some or all of the bytes to be hashed. Multiple calls to this method may be made to sequentially supply the bytes for hashing. Once all bytes have been supplied, either thedigestHash()
method (preferred) or thedigest()
method should be called to complete the hash calculation. -
reset
public void reset()Clears all bytes previously passed toupdate(byte[])
and prepares for the calculation of a new hash. -
digest
public byte[] digest()Completes the hash of all bytes previously passed toupdate(byte[])
. -
digestHash
Completes the hash of all bytes previously passed toupdate(byte[])
. -
digestHash
Completes the hash of all bytes previously passed toupdate(byte[])
. Allows passing in a re-usableMurmurHash3.Hash128
instance to avoid allocations. -
getAlgorithm
-