public final class MD5
extends java.security.MessageDigest
implements java.lang.Cloneable
The MD5 message-digest algorithm takes as input a message of arbitrary length and produces as output a 128-bit "fingerprint" or "message digest" of the input. It is conjectured that it is computationally infeasible to produce two messages having the same message digest, or to produce any message having a given prespecified target message digest.
References:
Constructor and Description |
---|
MD5()
Creates a MD5 object with default initial state.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
clone()
Clones this object.
|
byte[] |
engineDigest()
Completes the hash computation by performing final operations
such as padding.
|
int |
engineDigest(byte[] hashvalue,
int offset,
int length)
Completes the hash computation by performing final operations
such as padding.
|
int |
engineGetDigestLength()
Returns the digest length in bytes.
|
void |
engineReset()
Reset then initialize the digest context.
Overrides the protected abstract method of java.security.MessageDigestSpi . |
void |
engineUpdate(byte input)
Updates the digest using the specified byte.
|
void |
engineUpdate(byte[] input,
int offset,
int length)
Updates the digest using the specified array of bytes,
starting at the specified offset.
Input length can be any size. |
protected void |
init()
Initialize the digest context.
|
public java.lang.Object clone() throws java.lang.CloneNotSupportedException
clone
in class java.security.MessageDigest
java.lang.CloneNotSupportedException
public void engineReset()
java.security.MessageDigestSpi
.engineReset
in class java.security.MessageDigestSpi
protected void init()
public void engineUpdate(byte input)
java.security.MessageDigestSpi
.engineUpdate
in class java.security.MessageDigestSpi
input
- the byte to use for the update.public void engineUpdate(byte[] input, int offset, int length)
java.security.MessageDigestSpi
.engineUpdate
in class java.security.MessageDigestSpi
input
- the array of bytes to use for the update.offset
- the offset to start from in the array of bytes.length
- the number of bytes to use, starting at offset.public byte[] engineDigest()
java.security.MessageDigestSpi
.engineDigest
in class java.security.MessageDigestSpi
public int engineGetDigestLength()
java.security.MessageDigestSpi
.engineGetDigestLength
in class java.security.MessageDigestSpi
public int engineDigest(byte[] hashvalue, int offset, int length) throws java.security.DigestException
java.security.MessageDigestSpi
.engineDigest
in class java.security.MessageDigestSpi
hashvalue
- the output buffer in which to store the digest.offset
- offset to start from in the output bufferlength
- number of bytes within buf allotted for the digest.
Both this default implementation and the SUN provider
do not return partial digests. The presence of this
parameter is solely for consistency in our API's.
If the value of this parameter is less than the
actual digest length, the method will throw a
DigestException. This parameter is ignored if its
value is greater than or equal to the actual digest
length.java.security.DigestException