final class MacHashFunction extends AbstractHashFunction
HashFunction
adapter for Mac
instances.Modifier and Type | Class and Description |
---|---|
private static class |
MacHashFunction.MacHasher
Hasher that updates a
Mac (message authentication code). |
Modifier and Type | Field and Description |
---|---|
private int |
bits |
private java.security.Key |
key |
private javax.crypto.Mac |
prototype |
private boolean |
supportsClone |
private java.lang.String |
toString |
Constructor and Description |
---|
MacHashFunction(java.lang.String algorithmName,
java.security.Key key,
java.lang.String toString) |
Modifier and Type | Method and 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, stateful
Hasher
instance that is ready to receive data. |
private static boolean |
supportsClone(javax.crypto.Mac mac) |
java.lang.String |
toString() |
hashBytes, hashBytes, hashBytes, hashInt, hashLong, hashObject, hashString, hashUnencodedChars, newHasher
private final javax.crypto.Mac prototype
private final java.security.Key key
private final java.lang.String toString
private final int bits
private final boolean supportsClone
MacHashFunction(java.lang.String algorithmName, java.security.Key key, java.lang.String toString)
public int bits()
HashFunction
private static boolean supportsClone(javax.crypto.Mac mac)
private static javax.crypto.Mac getMac(java.lang.String algorithmName, java.security.Key key)
public Hasher newHasher()
HashFunction
Hasher
instance that is ready to receive data. Example:
HashFunction hf = Hashing.md5();
HashCode hc = hf.newHasher()
.putLong(id)
.putBoolean(isActive)
.hash();
public java.lang.String toString()
toString
in class java.lang.Object