Class Murmur3Hasher

org.elasticsearch.common.hash.Murmur3Hasher

public class Murmur3Hasher extends
Wraps that allows hashing of byte arrays passed through multiple calls to update(byte[]). Like , 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

    Fields
    Modifier and Type
    Field
    Description
    static
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Murmur3Hasher​(long seed)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    byte[]
    Completes the hash of all bytes previously passed to update(byte[]).
     
    void
    Clears all bytes previously passed to update(byte[]) and prepares for the calculation of a new hash.
    toHash128​(byte[] doubleLongBytes)
    Converts the 128-bit byte array returned by digest() to a MurmurHash3.Hash128
    void
    update​(byte[] inputBytes)
    Supplies some or all of the bytes to be hashed.

    Methods inherited from class java.lang.

    , , , , , , , , , ,
  • Field Details

  • 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, the digest() method should be called to complete the hash calculation.
    • reset

      public void reset()
      Clears all bytes previously passed to update(byte[]) and prepares for the calculation of a new hash.
    • digest

      public byte[] digest()
      Completes the hash of all bytes previously passed to update(byte[]).
    • getAlgorithm

      public  getAlgorithm()
    • toHash128

      public static MurmurHash3.Hash128 toHash128(byte[] doubleLongBytes)
      Converts the 128-bit byte array returned by digest() to a MurmurHash3.Hash128