Class MurmurHash3.IncrementalHash32x86

  • Direct Known Subclasses:
    MurmurHash3.IncrementalHash32
    Enclosing class:
    MurmurHash3

    public static class MurmurHash3.IncrementalHash32x86
    extends Object
    Generates 32-bit hash from input bytes. Bytes can be added incrementally and the new hash computed.

    This is an implementation of the 32-bit hash function MurmurHash3_x86_32 from from Austin Applyby's original MurmurHash3 c++ code in SMHasher.

    Since:
    1.14
    • Constructor Detail

      • IncrementalHash32x86

        public IncrementalHash32x86()
    • Method Detail

      • start

        public final void start​(int seed)
        Starts a new incremental hash.
        Parameters:
        seed - The initial seed value
      • add

        public final void add​(byte[] data,
                              int offset,
                              int length)
        Adds the byte array to the current incremental hash.
        Parameters:
        data - The input byte array
        offset - The offset of data
        length - The length of array
      • end

        public final int end()
        Generate the 32-bit hash value. Repeat calls to this method with no additional data will generate the same hash value.
        Returns:
        The 32-bit hash
      • finalise

        int finalise​(int hash,
                     int unprocessedLength,
                     byte[] unprocessed,
                     int totalLen)
        Finalize the running hash to the output 32-bit hash by processing remaining bytes and performing final mixing.
        Parameters:
        hash - The running hash
        unprocessedLength - The number of unprocessed bytes in the tail data.
        unprocessed - Up to 3 unprocessed bytes from input data.
        totalLen - The total number of input bytes added since the start.
        Returns:
        The 32-bit hash