public final class

MD2

extends MessageDigestSpi
implements Cloneable
java.lang.Object
   ↳ java.security.MessageDigestSpi
     ↳ sun.security.provider.MD2

Class Overview

Implementation for the MD2 algorithm, see RFC1319. It is very slow and not particular secure. It is only supported to be able to verify RSA/Verisign root certificates signed using MD2withRSA. It should not be used for anything else.

Summary

Public Constructors
MD2()
Create a new MD2 digest.
Public Methods
Object clone()
Clone this digest.
Protected Methods
final byte[] engineDigest()
Completes the hash computation by performing final operations such as padding.
final int engineDigest(byte[] out, int ofs, int len)
Completes the hash computation by performing final operations such as padding.
final int engineGetDigestLength()
Returns the digest length in bytes.
final void engineReset()
Resets the digest for further use.
final void engineUpdate(byte[] b, int ofs, int len)
Updates the digest using the specified array of bytes, starting at the specified offset.
final void engineUpdate(byte b)
Updates the digest using the specified byte.
[Expand]
Inherited Methods
From class java.security.MessageDigestSpi
From class java.lang.Object

Public Constructors

public MD2 ()

Create a new MD2 digest. Called by the JCA framework

Public Methods

public Object clone ()

Clone this digest. Should be implemented as "return new MyDigest(this)". That constructor should first call "super(baseDigest)" and then copy subclass specific data.

Returns
  • a clone if the implementation is cloneable.

Protected Methods

protected final byte[] engineDigest ()

Completes the hash computation by performing final operations such as padding. Once engineDigest has been called, the engine should be reset (see engineReset). Resetting is the responsibility of the engine implementor.

Returns
  • the array of bytes for the resulting hash value.

protected final int engineDigest (byte[] out, int ofs, int len)

Completes the hash computation by performing final operations such as padding. Once engineDigest has been called, the engine should be reset (see engineReset). Resetting is the responsibility of the engine implementor. This method should be abstract, but we leave it concrete for binary compatibility. Knowledgeable providers should override this method.

Parameters
out the output buffer in which to store the digest
ofs offset to start from in the output buffer
len 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.
Returns
  • the length of the digest stored in the output buffer.

protected final int engineGetDigestLength ()

Returns the digest length in bytes.

This concrete method has been added to this previously-defined abstract class. (For backwards compatibility, it cannot be abstract.)

The default behavior is to return 0.

This method may be overridden by a provider to return the digest length.

Returns
  • the digest length in bytes.

protected final void engineReset ()

Resets the digest for further use.

protected final void engineUpdate (byte[] b, int ofs, int len)

Updates the digest using the specified array of bytes, starting at the specified offset.

Parameters
b the array of bytes to use for the update.
ofs the offset to start from in the array of bytes.
len the number of bytes to use, starting at offset.

protected final void engineUpdate (byte b)

Updates the digest using the specified byte.

Parameters
b the byte to use for the update.