Package com.google.common.hash
Class MessageDigestHashFunction
java.lang.Object
com.google.common.hash.AbstractHashFunction
com.google.common.hash.MessageDigestHashFunction
- All Implemented Interfaces:
HashFunction,Serializable
HashFunction adapter for MessageDigest instances.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final classHasher that updates a message digest.private static final class -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final intprivate final MessageDigestprivate final booleanprivate final String -
Constructor Summary
ConstructorsConstructorDescriptionMessageDigestHashFunction(String algorithmName, int bytes, String toString) MessageDigestHashFunction(String algorithmName, String toString) -
Method Summary
Modifier and TypeMethodDescriptionintbits()Returns the number of bits (a multiple of 32) that each hash code produced by this hash function has.private static MessageDigestgetMessageDigest(String algorithmName) Begins a new hash code computation by returning an initialized, statefulHasherinstance that is ready to receive data.private voidreadObject(ObjectInputStream stream) private static booleansupportsClone(MessageDigest digest) toString()(package private) ObjectMethods inherited from class com.google.common.hash.AbstractHashFunction
hashBytes, hashBytes, hashBytes, hashInt, hashLong, hashObject, hashString, hashUnencodedChars, newHasher
-
Field Details
-
prototype
-
bytes
private final int bytes -
supportsClone
private final boolean supportsClone -
toString
-
-
Constructor Details
-
MessageDigestHashFunction
-
MessageDigestHashFunction
-
-
Method Details
-
supportsClone
-
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
-
getMessageDigest
-
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
Object writeReplace() -
readObject
- Throws:
InvalidObjectException
-