Class SipHashFunction

java.lang.Object
com.google.common.hash.AbstractHashFunction
com.google.common.hash.SipHashFunction
All Implemented Interfaces:
HashFunction, Serializable

final class SipHashFunction extends AbstractHashFunction implements Serializable
HashFunction implementation of SipHash-c-d.
  • Field Details

    • SIP_HASH_24

      static final HashFunction SIP_HASH_24
    • c

      private final int c
    • d

      private final int d
    • k0

      private final long k0
    • k1

      private final long k1
    • serialVersionUID

      private static final long serialVersionUID
      See Also:
  • Constructor Details

    • SipHashFunction

      SipHashFunction(int c, int d, long k0, long k1)
      Parameters:
      c - the number of compression rounds (must be positive)
      d - the number of finalization rounds (must be positive)
      k0 - the first half of the key
      k1 - the second half of the key
  • Method Details

    • bits

      public int bits()
      Description copied from interface: HashFunction
      Returns the number of bits (a multiple of 32) that each hash code produced by this hash function has.
      Specified by:
      bits in interface HashFunction
    • newHasher

      public Hasher newHasher()
      Description copied from interface: HashFunction
      Begins a new hash code computation by returning an initialized, stateful Hasher instance that is ready to receive data. Example:
      
       HashFunction hf = Hashing.md5();
       HashCode hc = hf.newHasher()
           .putLong(id)
           .putBoolean(isActive)
           .hash();
       
      Specified by:
      newHasher in interface HashFunction
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(@CheckForNull Object object)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object