java.lang.Object
java.security.MessageDigestSpi
java.security.MessageDigest
com.hierynomus.security.jce.messagedigest.MD4

public class MD4 extends MessageDigest
MD4.java - An implementation of Ron Rivest's MD4 message digest algorithm. The MD4 algorithm is designed to be quite fast on 32-bit machines. In addition, the MD4 algorithm does not require any large substitution tables.
Since:
MINA 2.0.0-M3
See Also:
  • invalid reference
    MD4 Message-
          Digest Algorithm by R. Rivest.
  • Field Details

    • BYTE_DIGEST_LENGTH

      public static final int BYTE_DIGEST_LENGTH
      The MD4 algorithm message digest length is 16 bytes wide.
      See Also:
    • BYTE_BLOCK_LENGTH

      public static final int BYTE_BLOCK_LENGTH
      The MD4 algorithm block length is 64 bytes wide.
      See Also:
    • A

      private static final int A
      The initial values of the four registers. RFC gives the values in LE so we converted it as JAVA uses BE endianness.
      See Also:
    • B

      private static final int B
      See Also:
    • C

      private static final int C
      See Also:
    • D

      private static final int D
      See Also:
    • a

      private int a
      The four registers initialized with the above IVs.
    • b

      private int b
    • c

      private int c
    • d

      private int d
    • msgLength

      private long msgLength
      Counts the total length of the data being digested.
    • buffer

      private final byte[] buffer
      The internal buffer is
      invalid reference
      BLOCK_LENGTH
      wide.
  • Constructor Details

    • MD4

      public MD4()
      Default constructor.
  • Method Details

    • engineGetDigestLength

      protected int engineGetDigestLength()
      Returns the digest length in bytes.
      Overrides:
      engineGetDigestLength in class MessageDigestSpi
      Returns:
      the digest length in bytes.
    • engineUpdate

      protected void engineUpdate(byte b)
      Specified by:
      engineUpdate in class MessageDigestSpi
    • engineUpdate

      protected void engineUpdate(byte[] b, int offset, int len)
      Specified by:
      engineUpdate in class MessageDigestSpi
    • engineDigest

      protected byte[] engineDigest()
      Specified by:
      engineDigest in class MessageDigestSpi
    • engineDigest

      protected int engineDigest(byte[] buf, int offset, int len) throws DigestException
      Overrides:
      engineDigest in class MessageDigestSpi
      Throws:
      DigestException
    • engineReset

      protected void engineReset()
      Specified by:
      engineReset in class MessageDigestSpi
    • pad

      private byte[] pad()
      Pads the buffer by appending the byte 0x80, then append as many zero bytes as necessary to make the buffer length a multiple of 64 bytes. The last 8 bytes will be filled with the length of the buffer in bits. If there's no room to store the length in bits in the block i.e the block is larger than 56 bytes then an additionnal 64-bytes block is appended.
      Returns:
      the pad byte array
      See Also:
      • invalid reference
        3.1 invalid input: '&' 3.2 of the RFC 1320.
    • process

      private void process(byte[] in, int offset)
      Process one 64-byte block. Algorithm is constituted by three rounds. Note that F, G and H functions were inlined for improved performance.
      Parameters:
      in - the byte array to process
      offset - the offset at which the 64-byte block is stored