org.metastatic.rsync
Class MD4

java.lang.Object
  |
  +--java.security.MessageDigestSpi
        |
        +--org.metastatic.rsync.MD4
All Implemented Interfaces:
Cloneable
Direct Known Subclasses:
BrokenMD4

public class MD4
extends MessageDigestSpi
implements Cloneable

An implementation of Ron Rivest's MD4 message digest algorithm. MD4 was the precursor to the stronger MD5 algorithm, and while not considered cryptograpically secure itself, MD4 is in use in various applications. It is slightly faster than MD5.

This implementation is derived from the version of MD4 in GNU Crypto.

References:

  1. The MD4 Message- Digest Algorithm.
    R. Rivest.


Field Summary
protected  int a
           
protected static int A
           
protected  int b
           
protected static int B
           
static int BLOCK_LENGTH
          The MD4 algorithm operates on 512-bit blocks, or 64 bytes.
protected  byte[] buffer
           
protected  int c
           
protected static int C
           
protected  long count
           
protected  int d
           
protected static int D
           
static int DIGEST_LENGTH
          An MD4 message digest is always 128-bits long, or 16 bytes.
 
Constructor Summary
MD4()
          Trivial zero-argument constructor.
 
Method Summary
 Object clone()
           
protected  byte[] engineDigest()
          Pack the four chaining variables into a byte array.
protected  int engineDigest(byte[] out, int off, int len)
           
protected  int engineGetDigestLength()
           
protected  void engineReset()
          Reset the four chaining variables.
 void engineUpdate(byte b)
           
protected  void engineUpdate(byte[] b, int offset, int len)
           
protected  byte[] padBuffer()
          Pad the buffer by appending the byte 0x80, then as many zero bytes to fill the buffer 8 bytes shy of being a multiple of 64 bytes, then append the length of the buffer, in bits, before padding.
protected  void transform(byte[] in, int offset)
          Transform a 64-byte block.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DIGEST_LENGTH

public static final int DIGEST_LENGTH
An MD4 message digest is always 128-bits long, or 16 bytes.

See Also:
Constant Field Values

BLOCK_LENGTH

public static final int BLOCK_LENGTH
The MD4 algorithm operates on 512-bit blocks, or 64 bytes.

See Also:
Constant Field Values

A

protected static final int A
See Also:
Constant Field Values

B

protected static final int B
See Also:
Constant Field Values

C

protected static final int C
See Also:
Constant Field Values

D

protected static final int D
See Also:
Constant Field Values

a

protected int a

b

protected int b

c

protected int c

d

protected int d

count

protected long count

buffer

protected final byte[] buffer
Constructor Detail

MD4

public MD4()
Trivial zero-argument constructor.

Method Detail

clone

public Object clone()
Overrides:
clone in class MessageDigestSpi

engineGetDigestLength

protected int engineGetDigestLength()
Overrides:
engineGetDigestLength in class MessageDigestSpi

engineUpdate

public 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()
Pack the four chaining variables into a byte array.

Specified by:
engineDigest in class MessageDigestSpi

engineDigest

protected int engineDigest(byte[] out,
                           int off,
                           int len)
                    throws DigestException
Overrides:
engineDigest in class MessageDigestSpi
DigestException

engineReset

protected void engineReset()
Reset the four chaining variables.

Specified by:
engineReset in class MessageDigestSpi

padBuffer

protected byte[] padBuffer()
Pad the buffer by appending the byte 0x80, then as many zero bytes to fill the buffer 8 bytes shy of being a multiple of 64 bytes, then append the length of the buffer, in bits, before padding.


transform

protected void transform(byte[] in,
                         int offset)
Transform a 64-byte block.