Package io.milton.zsync
Class MD4
java.lang.Object
java.security.MessageDigestSpi
io.milton.zsync.MD4
- All Implemented Interfaces:
Cloneable
- Direct Known Subclasses:
BrokenMD4
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:
- The MD4 Message-
Digest Algorithm.
R. Rivest.
- Version:
- $Revision: 1.9 $
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected intprotected static final intprotected intprotected static final intstatic final intThe MD4 algorithm operates on 512-bit blocks, or 64 bytes.protected final byte[]protected intprotected static final intprotected longprotected intprotected static final intstatic final intAn MD4 message digest is always 128-bits long, or 16 bytes. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionclone()protected byte[]Pack the four chaining variables into a byte array.protected intengineDigest(byte[] out, int off, int len) protected intprotected voidReset the four chaining variables.voidengineUpdate(byte b) protected voidengineUpdate(byte[] b, int offset, int len) protected byte[]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 voidtransform(byte[] in, int offset) Transform a 64-byte block.Methods inherited from class java.security.MessageDigestSpi
engineUpdate
-
Field Details
-
DIGEST_LENGTH
public static final int DIGEST_LENGTHAn MD4 message digest is always 128-bits long, or 16 bytes.- See Also:
-
BLOCK_LENGTH
public static final int BLOCK_LENGTHThe MD4 algorithm operates on 512-bit blocks, or 64 bytes.- See Also:
-
A
protected static final int A- See Also:
-
B
protected static final int B- See Also:
-
C
protected static final int C- See Also:
-
D
protected static final int D- See Also:
-
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 Details
-
MD4
public MD4()Trivial zero-argument constructor.
-
-
Method Details
-
clone
- Overrides:
clonein classMessageDigestSpi
-
engineGetDigestLength
protected int engineGetDigestLength()- Overrides:
engineGetDigestLengthin classMessageDigestSpi
-
engineUpdate
public void engineUpdate(byte b) - Specified by:
engineUpdatein classMessageDigestSpi
-
engineUpdate
protected void engineUpdate(byte[] b, int offset, int len) - Specified by:
engineUpdatein classMessageDigestSpi
-
engineDigest
protected byte[] engineDigest()Pack the four chaining variables into a byte array.- Specified by:
engineDigestin classMessageDigestSpi
-
engineDigest
- Overrides:
engineDigestin classMessageDigestSpi- Throws:
DigestException
-
engineReset
protected void engineReset()Reset the four chaining variables.- Specified by:
engineResetin classMessageDigestSpi
-
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.
-