final class MessageDigestHashFunction extends AbstractHashFunction implements java.io.Serializable
HashFunction
adapter for MessageDigest
instances.Modifier and Type | Class and Description |
---|---|
private static class |
MessageDigestHashFunction.MessageDigestHasher
Hasher that updates a message digest.
|
private static class |
MessageDigestHashFunction.SerializedForm |
Modifier and Type | Field and Description |
---|---|
private int |
bytes |
private java.security.MessageDigest |
prototype |
private boolean |
supportsClone |
private java.lang.String |
toString |
Constructor and Description |
---|
MessageDigestHashFunction(java.lang.String algorithmName,
int bytes,
java.lang.String toString) |
MessageDigestHashFunction(java.lang.String algorithmName,
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 java.security.MessageDigest |
getMessageDigest(java.lang.String algorithmName) |
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(java.security.MessageDigest digest) |
java.lang.String |
toString() |
(package private) java.lang.Object |
writeReplace() |
hashBytes, hashBytes, hashBytes, hashInt, hashLong, hashObject, hashString, hashUnencodedChars, newHasher
private final java.security.MessageDigest prototype
private final int bytes
private final boolean supportsClone
private final java.lang.String toString
MessageDigestHashFunction(java.lang.String algorithmName, java.lang.String toString)
MessageDigestHashFunction(java.lang.String algorithmName, int bytes, java.lang.String toString)
private static boolean supportsClone(java.security.MessageDigest digest)
public int bits()
HashFunction
bits
in interface HashFunction
public java.lang.String toString()
toString
in class java.lang.Object
private static java.security.MessageDigest getMessageDigest(java.lang.String algorithmName)
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();
newHasher
in interface HashFunction
java.lang.Object writeReplace()