Class MacHashFunction

java.lang.Object
com.google.common.hash.AbstractHashFunction
com.google.common.hash.MacHashFunction
All Implemented Interfaces:
HashFunction

final class MacHashFunction extends AbstractHashFunction
HashFunction adapter for Mac instances.
  • Field Details

    • prototype

      private final Mac prototype
    • key

      private final Key key
    • toString

      private final String toString
    • bits

      private final int bits
    • supportsClone

      private final boolean supportsClone
  • Constructor Details

    • MacHashFunction

      MacHashFunction(String algorithmName, Key key, String toString)
  • 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.
    • supportsClone

      private static boolean supportsClone(Mac mac)
    • getMac

      private static Mac getMac(String algorithmName, Key key)
    • 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();
       
    • toString

      public String toString()
      Overrides:
      toString in class Object