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
HashFunctionadapter forMessageDigestinstances.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classMessageDigestHashFunction.MessageDigestHasherHasher that updates a message digest.private static classMessageDigestHashFunction.SerializedForm
-
Field Summary
Fields Modifier and Type Field Description private intbytesprivate java.security.MessageDigestprototypeprivate booleansupportsCloneprivate java.lang.StringtoString
-
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 intbits()Returns the number of bits (a multiple of 32) that each hash code produced by this hash function has.private static java.security.MessageDigestgetMessageDigest(java.lang.String algorithmName)HashernewHasher()Begins a new hash code computation by returning an initialized, statefulHasherinstance that is ready to receive data.private static booleansupportsClone(java.security.MessageDigest digest)java.lang.StringtoString()(package private) java.lang.ObjectwriteReplace()-
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:HashFunctionReturns the number of bits (a multiple of 32) that each hash code produced by this hash function has.- Specified by:
bitsin interfaceHashFunction
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
getMessageDigest
private static java.security.MessageDigest getMessageDigest(java.lang.String algorithmName)
-
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();- Specified by:
newHasherin interfaceHashFunction
-
writeReplace
java.lang.Object writeReplace()
-
-