Package generic.hash
Interface MessageDigest
- All Known Implementing Classes:
AbstractMessageDigest
,FNV1a32MessageDigest
,FNV1a64MessageDigest
public interface MessageDigest
-
Method Summary
Modifier and TypeMethodDescriptionbyte[]
digest()
Completes the hash computation by performing final operations such as padding.int
digest
(byte[] buf, int offset, int len) Completes the hash computation by performing final operations such as padding.long
Completes the hash computation by performing final operations such as padding, and returns (up to) the first 8 bytes as a big-endian long value.Returns a string that identifies the algorithm, independent of implementation details.int
Returns the length of the digest in bytes.void
reset()
Resets the digest for further use.void
update
(byte input) Updates the digest using the specified byte.void
update
(byte[] input) Updates the digest using the specified array of bytes.void
update
(byte[] input, int offset, int len) Updates the digest using the specified array of bytes, starting at the specified offset (and for the specified length).void
update
(byte[] input, int offset, int len, TaskMonitor monitor) Updates the digest using the specified array of bytes, starting at the specified offset (and for the specified length).void
update
(byte[] input, TaskMonitor monitor) Updates the digest using the specified array of bytes.void
update
(int input) Updates the digest using the specified int.void
update
(long input) Updates the digest using the specified long.void
update
(short input) Updates the digest using the specified short.
-
Method Details
-
getAlgorithm
String getAlgorithm()Returns a string that identifies the algorithm, independent of implementation details.- Returns:
- the name of the algorithm
-
getDigestLength
int getDigestLength()Returns the length of the digest in bytes.- Returns:
- the digest length in bytes
-
update
void update(byte input) Updates the digest using the specified byte.- Parameters:
input
- the byte with which to update the digest
-
update
void update(short input) Updates the digest using the specified short.- Parameters:
input
- the short with which to update the digest (big endian)
-
update
void update(int input) Updates the digest using the specified int.- Parameters:
input
- the int with which to update the digest (big endian)
-
update
void update(long input) Updates the digest using the specified long.- Parameters:
input
- the long with which to update the digest (big endian)
-
update
void update(byte[] input) Updates the digest using the specified array of bytes. Do not use a monitor- Parameters:
input
- the array of bytes
-
update
void update(byte[] input, int offset, int len) Updates the digest using the specified array of bytes, starting at the specified offset (and for the specified length). Do not use a monitor.- 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
Updates the digest using the specified array of bytes.- Parameters:
input
- the array of bytesmonitor
- the monitor to check during loops- Throws:
CancelledException
-
update
Updates the digest using the specified array of bytes, starting at the specified offset (and for the specified length).- 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
-
digest
byte[] digest()Completes the hash computation by performing final operations such as padding. The digest is reset after this call is made.- Returns:
- the array of bytes for the resulting hash value
-
digestLong
long digestLong()Completes the hash computation by performing final operations such as padding, and returns (up to) the first 8 bytes as a big-endian long value. The digest is reset after this call is made.- Returns:
- the digest value as a long value
-
digest
int digest(byte[] buf, int offset, int len) Completes the hash computation by performing final operations such as padding. The digest is reset after this call is made.- Parameters:
buf
- output buffer for the computed digestoffset
- offset into the output buffer to begin storing the digestlen
- number of bytes within buf allocated for the digest- Returns:
- the number of bytes placed into buf
-
reset
void reset()Resets the digest for further use.
-