Class MacHashFunction

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      private static class  MacHashFunction.MacHasher
      Hasher that updates a Mac (message authentication code).
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private int bits  
      private java.security.Key key  
      private javax.crypto.Mac prototype  
      private boolean supportsClone  
      private java.lang.String toString  
    • Constructor Summary

      Constructors 
      Constructor Description
      MacHashFunction​(java.lang.String algorithmName, java.security.Key key, java.lang.String toString)  
    • Field Detail

      • prototype

        private final javax.crypto.Mac prototype
      • key

        private final java.security.Key key
      • toString

        private final java.lang.String toString
      • bits

        private final int bits
      • supportsClone

        private final boolean supportsClone
    • Constructor Detail

      • MacHashFunction

        MacHashFunction​(java.lang.String algorithmName,
                        java.security.Key key,
                        java.lang.String toString)
    • Method Detail

      • 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​(javax.crypto.Mac mac)
      • getMac

        private static javax.crypto.Mac getMac​(java.lang.String algorithmName,
                                               java.security.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 java.lang.String toString()
        Overrides:
        toString in class java.lang.Object