java.security
public abstract class MessageDigest extends MessageDigestSpi
Since: JDK 1.1
See Also: MessageDigestSpi
Constructor Summary | |
---|---|
protected | MessageDigest(String algorithm)
Constructs a new instance of MessageDigest representing the
specified algorithm.
|
Method Summary | |
---|---|
Object | clone()
Returns a clone of this instance if cloning is supported. |
byte[] | digest()
Computes the final digest of the stored data.
|
int | digest(byte[] buf, int offset, int len)
Computes the final digest of the stored bytes and returns the result.
|
byte[] | digest(byte[] input)
Computes a final update using the input array of bytes, then computes a
final digest and returns it. |
String | getAlgorithm()
Returns the name of message digest algorithm.
|
int | getDigestLength()
Returns the length of the message digest. |
static MessageDigest | getInstance(String algorithm)
Returns a new instance of MessageDigest representing the
specified algorithm.
|
static MessageDigest | getInstance(String algorithm, String provider)
Returns a new instance of MessageDigest representing the
specified algorithm from a named provider.
|
static MessageDigest | getInstance(String algorithm, Provider provider)
Returns a new instance of MessageDigest representing the
specified algorithm from a designated {@link Provider}.
|
Provider | getProvider()
Returns the {@link Provider} of this instance.
|
static boolean | isEqual(byte[] digesta, byte[] digestb)
Does a simple byte comparison of the two digests.
|
void | reset() Resets this instance. |
String | toString()
Returns a string representation of this instance.
|
void | update(byte input)
Updates the digest with the byte.
|
void | update(byte[] input, int offset, int len)
Updates the digest with the bytes from the array starting from the
specified offset and using the specified length of bytes.
|
void | update(byte[] input)
Updates the digest with the bytes of an array.
|
void | update(ByteBuffer input)
Updates the digest with the remaining bytes of a buffer.
|
MessageDigest
representing the
specified algorithm.
Parameters: algorithm the name of the digest algorithm to use.
Returns: a clone of this instance.
Throws: CloneNotSupportedException the implementation does not support cloning.
Returns: a byte array representing the message digest.
Parameters: buf an array of bytes to store the result in. offset an offset to start storing the result at. len the length of the buffer.
Returns: Returns the length of the buffer.
Parameters: input an array of bytes to perform final update with.
Returns: a byte array representing the message digest.
Returns: the name of message digest algorithm.
Returns: length of the message digest.
Since: 1.2
MessageDigest
representing the
specified algorithm.
Parameters: algorithm the name of the digest algorithm to use.
Returns: a new instance representing the desired algorithm.
Throws: NoSuchAlgorithmException if the algorithm is not implemented by any
provider. IllegalArgumentException if algorithm
is
null
or is an empty string.
MessageDigest
representing the
specified algorithm from a named provider.
Parameters: algorithm the name of the digest algorithm to use. provider the name of the provider to use.
Returns: a new instance representing the desired algorithm.
Throws: NoSuchAlgorithmException if the algorithm is not implemented by the
named provider. NoSuchProviderException if the named provider was not found. IllegalArgumentException if either algorithm
or
provider
is null
or empty.
MessageDigest
representing the
specified algorithm from a designated {@link Provider}.
Parameters: algorithm the name of the digest algorithm to use. provider the {@link Provider} to use.
Returns: a new instance representing the desired algorithm.
Throws: NoSuchAlgorithmException if the algorithm is not implemented by
{@link Provider}. IllegalArgumentException if either algorithm
or
provider
is null
, or if
algorithm
is an empty string.
Since: 1.4
See Also: Provider
Returns: the {@link Provider} of this instance.
Parameters: digesta first digest to compare. digestb second digest to compare.
Returns: true
if both are equal, false
otherwise.
Returns: a string representation of this instance.
Parameters: input byte to update the digest with.
Parameters: input bytes to update the digest with. offset the offset to start at. len length of the data to update with.
Parameters: input bytes to update the digest with.
Parameters: input The input byte buffer.
Since: 1.5