jonelo.jacksum.adapt.gnu.crypto.hash

Class MD2


public class MD2
extends BaseHash

An implementation of the MD2 message digest algorithm.

MD2 is not widely used. Unless it is needed for compatibility with existing systems, it is not recommended for use in new applications.

References:

  1. The MD2 Message-Digest Algorithm.
    B. Kaliski.
  2. The RFC ERRATA PAGE under section RFC 1319.

Constructor Summary

MD2()
Creates a new MD2 digest ready for use.

Method Summary

Object
clone()
protected byte[]
getResult()
protected byte[]
padBuffer()
Generates an array of padding bytes.
protected void
resetContext()
boolean
selfTest()
protected void
transform(byte[] in, int off)
Adds BLOCK_LENGTH bytes to the running digest.

Constructor Details

MD2

public MD2()
Creates a new MD2 digest ready for use.

Method Details

clone

public Object clone()

getResult

protected byte[] getResult()

padBuffer

protected byte[] padBuffer()
Generates an array of padding bytes. The padding is defined as i bytes of value i, where i is the number of bytes to fill the last block of the message to BLOCK_LENGTH bytes (or BLOCK_LENGTH bytes when the last block was completely full).
Returns:
the bytes to pad the remaining bytes in the buffer before completing a hash operation.

resetContext

protected void resetContext()

selfTest

public boolean selfTest()

transform

protected void transform(byte[] in,
                         int off)
Adds BLOCK_LENGTH bytes to the running digest.
Parameters:
in - the byte array to take the BLOCK_LENGTH bytes from.
off - the offset to start from in the given byte array.