Package com.google.common.hash
Class MacHashFunction
- java.lang.Object
-
- com.google.common.hash.AbstractStreamingHashFunction
-
- com.google.common.hash.MacHashFunction
-
- All Implemented Interfaces:
HashFunction
final class MacHashFunction extends AbstractStreamingHashFunction
HashFunction
adapter forMac
instances.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
MacHashFunction.MacHasher
Hasher that updates aMac
(message authentication code).-
Nested classes/interfaces inherited from class com.google.common.hash.AbstractStreamingHashFunction
AbstractStreamingHashFunction.AbstractStreamingHasher
-
-
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)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
bits()
Returns the number of bits (a multiple of 32) that each hash code produced by this hash function has.private static javax.crypto.Mac
getMac(java.lang.String algorithmName, java.security.Key key)
Hasher
newHasher()
Begins a new hash code computation by returning an initialized, statefulHasher
instance that is ready to receive data.private static boolean
supportsClone(javax.crypto.Mac mac)
java.lang.String
toString()
-
Methods inherited from class com.google.common.hash.AbstractStreamingHashFunction
hashBytes, hashBytes, hashInt, hashLong, hashObject, hashString, hashUnencodedChars, newHasher
-
-
-
-
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, statefulHasher
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 classjava.lang.Object
-
-