public final class

MD4

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

Class Overview

The MD4 class is used to compute an MD4 message digest over a given buffer of bytes. It is an implementation of the RSA Data Security Inc MD4 algorithim as described in internet RFC 1320.

The MD4 algorithm is very weak and should not be used unless it is unavoidable. Therefore, it is not registered in our standard providers. To obtain an implementation, call the static getInstance() method in this class.

Summary

Public Constructors
MD4()
Public Methods
Object clone()
Clone this digest.
static MessageDigest getInstance()
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 MD4 ()

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.

public static MessageDigest getInstance ()

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.