Package com.google.common.hash
Class MacHashFunction
- java.lang.Object
-
- com.google.common.hash.AbstractHashFunction
-
- com.google.common.hash.MacHashFunction
-
- All Implemented Interfaces:
HashFunction
final class MacHashFunction extends AbstractHashFunction
HashFunctionadapter forMacinstances.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classMacHashFunction.MacHasherHasher that updates aMac(message authentication code).
-
Field Summary
Fields Modifier and Type Field Description private intbitsprivate java.security.Keykeyprivate javax.crypto.Macprototypeprivate booleansupportsCloneprivate java.lang.StringtoString
-
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 intbits()Returns the number of bits (a multiple of 32) that each hash code produced by this hash function has.private static javax.crypto.MacgetMac(java.lang.String algorithmName, java.security.Key key)HashernewHasher()Begins a new hash code computation by returning an initialized, statefulHasherinstance that is ready to receive data.private static booleansupportsClone(javax.crypto.Mac mac)java.lang.StringtoString()-
Methods inherited from class com.google.common.hash.AbstractHashFunction
hashBytes, hashBytes, hashBytes, hashInt, hashLong, hashObject, hashString, hashUnencodedChars, newHasher
-
-
-
-
Method Detail
-
bits
public int bits()
Description copied from interface:HashFunctionReturns 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:HashFunctionBegins a new hash code computation by returning an initialized, statefulHasherinstance 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:
toStringin classjava.lang.Object
-
-