Package com.google.common.hash
Class MessageDigestHashFunction
- java.lang.Object
-
- com.google.common.hash.AbstractHashFunction
-
- com.google.common.hash.MessageDigestHashFunction
-
- All Implemented Interfaces:
HashFunction
,java.io.Serializable
final class MessageDigestHashFunction extends AbstractHashFunction implements java.io.Serializable
HashFunction
adapter forMessageDigest
instances.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
MessageDigestHashFunction.MessageDigestHasher
Hasher that updates a message digest.private static class
MessageDigestHashFunction.SerializedForm
-
Field Summary
Fields Modifier and Type Field Description private int
bytes
private java.security.MessageDigest
prototype
private boolean
supportsClone
private java.lang.String
toString
-
Constructor Summary
Constructors Constructor Description MessageDigestHashFunction(java.lang.String algorithmName, int bytes, java.lang.String toString)
MessageDigestHashFunction(java.lang.String algorithmName, 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 java.security.MessageDigest
getMessageDigest(java.lang.String algorithmName)
Hasher
newHasher()
Begins a new hash code computation by returning an initialized, statefulHasher
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()
-
Methods inherited from class com.google.common.hash.AbstractHashFunction
hashBytes, hashBytes, hashBytes, hashInt, hashLong, hashObject, hashString, hashUnencodedChars, newHasher
-
-
-
-
Method Detail
-
supportsClone
private static boolean supportsClone(java.security.MessageDigest digest)
-
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.- Specified by:
bits
in interfaceHashFunction
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
getMessageDigest
private static java.security.MessageDigest getMessageDigest(java.lang.String algorithmName)
-
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();
- Specified by:
newHasher
in interfaceHashFunction
-
writeReplace
java.lang.Object writeReplace()
-
-