| java.lang.Object java.security.MessageDigest
MessageDigest | abstract public class MessageDigest (Code) | | This MessageDigest class provides applications the functionality of a
message digest algorithm, such as MD5 or SHA.
Message digests are secure one-way hash functions that take arbitrary-sized
data and output a fixed-length hash value.
A MessageDigest object starts out initialized. The data is
processed through it using the update
method. At any point
MessageDigest.reset() reset can be called
to reset the digest. Once all the data to be updated has been
updated, the digest method should
be called to complete the hash computation.
The digest method can be called once for a given number
of updates. After digest has been called,
the MessageDigest
object is reset to its initialized state.
|
Constructor Summary | |
| MessageDigest(String algorithm) Creates a message digest with the specified algorithm name.
Parameters: algorithm - the standard name of the digest algorithm. |
Method Summary | |
public int | digest(byte[] buf, int offset, int len) Completes the hash computation by performing final operations
such as padding. | public static MessageDigest | getInstance(String algorithm) Generates a MessageDigest object that implements
the specified digest
algorithm. | public void | reset() Resets the digest for further use. | public void | update(byte[] input, int offset, int len) Updates the digest using the specified array of bytes, starting
at the specified offset.
Parameters: input - the array of bytes. Parameters: offset - the offset to start from in the array of bytes. Parameters: len - the number of bytes to use, starting at offset . |
MessageDigest | MessageDigest(String algorithm)(Code) | | Creates a message digest with the specified algorithm name.
Parameters: algorithm - the standard name of the digest algorithm. See Appendix A in theJava Cryptography Architecture API Specification & Reference for information about standard algorithm names. |
digest | public int digest(byte[] buf, int offset, int len) throws DigestException(Code) | | 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 digest Parameters: offset - offset into the output buffer to begin storing the digest Parameters: len - number of bytes within buf allotted for the digest the number of bytes placed into buf exception: DigestException - if an error occurs. |
getInstance | public static MessageDigest getInstance(String algorithm) throws NoSuchAlgorithmException(Code) | | Generates a MessageDigest object that implements
the specified digest
algorithm.
Parameters: algorithm - the name of the algorithm requested. See Appendix A in the Java Cryptography Architecture API Specification & Referencefor information about standard algorithm names. a MessageDigest object implementing the specifiedalgorithm. exception: NoSuchAlgorithmException - if the algorithm isnot available in the caller's environment. |
reset | public void reset()(Code) | | Resets the digest for further use.
|
update | public void update(byte[] input, int offset, int len)(Code) | | Updates the digest using the specified array of bytes, starting
at the specified offset.
Parameters: input - the array of bytes. Parameters: offset - the offset to start from in the array of bytes. Parameters: len - the number of bytes to use, starting at offset . |
|
|