Package generic.hash
Class AbstractMessageDigest
- java.lang.Object
-
- generic.hash.AbstractMessageDigest
-
- All Implemented Interfaces:
MessageDigest
- Direct Known Subclasses:
FNV1a32MessageDigest,FNV1a64MessageDigest
public abstract class AbstractMessageDigest extends java.lang.Object implements MessageDigest
-
-
Field Summary
Fields Modifier and Type Field Description java.lang.StringalgorithmintdigestLength
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractMessageDigest(java.lang.String algorithm, int digestLength)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]digest()Completes the hash computation by performing final operations such as padding.java.lang.StringgetAlgorithm()Returns a string that identifies the algorithm, independent of implementation details.intgetDigestLength()Returns the length of the digest in bytes.voidupdate(byte[] input)Updates the digest using the specified array of bytes.voidupdate(byte[] input, int offset, int len)You REALLY want to override this method.voidupdate(byte[] input, int offset, int len, TaskMonitor monitor)You REALLY want to override this method too.voidupdate(byte[] input, TaskMonitor monitor)Updates the digest using the specified array of bytes.voidupdate(int input)Updates the digest using the specified int.voidupdate(long input)Updates the digest using the specified long.voidupdate(short input)Updates the digest using the specified short.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface generic.hash.MessageDigest
digest, digestLong, reset, update
-
-
-
-
Method Detail
-
getAlgorithm
public final java.lang.String getAlgorithm()
Description copied from interface:MessageDigestReturns a string that identifies the algorithm, independent of implementation details.- Specified by:
getAlgorithmin interfaceMessageDigest- Returns:
- the name of the algorithm
-
getDigestLength
public final int getDigestLength()
Description copied from interface:MessageDigestReturns the length of the digest in bytes.- Specified by:
getDigestLengthin interfaceMessageDigest- Returns:
- the digest length in bytes
-
digest
public final byte[] digest()
Description copied from interface:MessageDigestCompletes the hash computation by performing final operations such as padding. The digest is reset after this call is made.- Specified by:
digestin interfaceMessageDigest- Returns:
- the array of bytes for the resulting hash value
-
update
public final void update(byte[] input, TaskMonitor monitor) throws CancelledExceptionDescription copied from interface:MessageDigestUpdates the digest using the specified array of bytes.- Specified by:
updatein interfaceMessageDigest- Parameters:
input- the array of bytesmonitor- the monitor to check during loops- Throws:
CancelledException
-
update
public final void update(byte[] input)
Description copied from interface:MessageDigestUpdates the digest using the specified array of bytes. Do not use a monitor- Specified by:
updatein interfaceMessageDigest- Parameters:
input- the array of bytes
-
update
public void update(short input)
Description copied from interface:MessageDigestUpdates the digest using the specified short.- Specified by:
updatein interfaceMessageDigest- Parameters:
input- the short with which to update the digest (big endian)
-
update
public void update(int input)
Description copied from interface:MessageDigestUpdates the digest using the specified int.- Specified by:
updatein interfaceMessageDigest- Parameters:
input- the int with which to update the digest (big endian)
-
update
public void update(long input)
Description copied from interface:MessageDigestUpdates the digest using the specified long.- Specified by:
updatein interfaceMessageDigest- Parameters:
input- the long with which to update the digest (big endian)
-
update
public void update(byte[] input, int offset, int len)You REALLY want to override this method.- Specified by:
updatein interfaceMessageDigest- Parameters:
input- the array of bytesoffset- the offset to start from in the array of byteslen- the number of bytes to use, starting at offset
-
update
public void update(byte[] input, int offset, int len, TaskMonitor monitor) throws CancelledExceptionYou REALLY want to override this method too.- Specified by:
updatein interfaceMessageDigest- Parameters:
input- the array of bytesoffset- the offset to start from in the array of byteslen- the number of bytes to use, starting at offsetmonitor- the monitor to check during loops- Throws:
CancelledException
-
-