java.lang.Object
com.ssttr.crypto.MessageDigest
com.ssttr.crypto.MD5
- public final class MD5
- extends MessageDigest
The MD5 class is used to compute an MD5 message digest over a given
buffer of bytes. It is an implementation of the RSA Data Security Inc
MD5 algorithim as described in internet RFC 1321.
- Version:
- 06 Oct 1996, 1.9.1
|
Field Summary |
private byte[] |
buffer
|
private long |
count
|
private static int |
S11
|
private static int |
S12
|
private static int |
S13
|
private static int |
S14
|
private static int |
S21
|
private static int |
S22
|
private static int |
S23
|
private static int |
S24
|
private static int |
S31
|
private static int |
S32
|
private static int |
S33
|
private static int |
S34
|
private static int |
S41
|
private static int |
S42
|
private static int |
S43
|
private static int |
S44
|
private int[] |
state
containss the computed message digest |
private static int[] |
transformBuffer
|
|
Constructor Summary |
MD5()
Standard constructor, creates a new MD5 instance, allocates its
buffers from the heap. |
MD5(byte[] mydigest)
Alternate constructor, allows you to pass in the buffer where you
want the resulting digest stored. |
|
Method Summary |
private int |
F(int x,
int y,
int z)
|
private int |
FF(int a,
int b,
int c,
int d,
int x,
int s,
int ac)
|
void |
finish()
Perform the final computations, any buffered bytes are added
to the digest, the count is added to the digest, and the resulting
digest is stored. |
private int |
G(int x,
int y,
int z)
|
java.lang.String |
getAlg()
Return a string that represents the algorithim of this
message digest. |
private int |
GG(int a,
int b,
int c,
int d,
int x,
int s,
int ac)
|
private int |
H(int x,
int y,
int z)
|
private int |
HH(int a,
int b,
int c,
int d,
int x,
int s,
int ac)
|
private int |
I(int x,
int y,
int z)
|
private int |
II(int a,
int b,
int c,
int d,
int x,
int s,
int ac)
|
void |
init()
Initialize the MD5 state information and reset the bit count
to 0. |
private int |
rotateLeft(int a,
int n)
|
(package private) void |
transform(byte[] buf,
int offset)
This is where the functions come together as the generic MD5
transformation operation, it is called by update() which is
synchronized (to protect transformBuffer) |
void |
update(byte b)
update adds the passed type to the input buffer |
| Methods inherited from class com.ssttr.crypto.MessageDigest |
benchmark, computeDigest, computeDigest, getDigest, getDigestBytes, getDigestHex, isEqual, isEqual, toString, update, update, update, update, update, update, update, update, update, update, update, updateASCII |
state
private int[] state
- containss the computed message digest
count
private long count
buffer
private byte[] buffer
transformBuffer
private static int[] transformBuffer
S11
private static final int S11
- See Also:
- Constant Field Values
S12
private static final int S12
- See Also:
- Constant Field Values
S13
private static final int S13
- See Also:
- Constant Field Values
S14
private static final int S14
- See Also:
- Constant Field Values
S21
private static final int S21
- See Also:
- Constant Field Values
S22
private static final int S22
- See Also:
- Constant Field Values
S23
private static final int S23
- See Also:
- Constant Field Values
S24
private static final int S24
- See Also:
- Constant Field Values
S31
private static final int S31
- See Also:
- Constant Field Values
S32
private static final int S32
- See Also:
- Constant Field Values
S33
private static final int S33
- See Also:
- Constant Field Values
S34
private static final int S34
- See Also:
- Constant Field Values
S41
private static final int S41
- See Also:
- Constant Field Values
S42
private static final int S42
- See Also:
- Constant Field Values
S43
private static final int S43
- See Also:
- Constant Field Values
S44
private static final int S44
- See Also:
- Constant Field Values
MD5
public MD5()
- Standard constructor, creates a new MD5 instance, allocates its
buffers from the heap.
MD5
public MD5(byte[] mydigest)
- Alternate constructor, allows you to pass in the buffer where you
want the resulting digest stored.
F
private int F(int x,
int y,
int z)
G
private int G(int x,
int y,
int z)
H
private int H(int x,
int y,
int z)
I
private int I(int x,
int y,
int z)
rotateLeft
private int rotateLeft(int a,
int n)
FF
private int FF(int a,
int b,
int c,
int d,
int x,
int s,
int ac)
GG
private int GG(int a,
int b,
int c,
int d,
int x,
int s,
int ac)
HH
private int HH(int a,
int b,
int c,
int d,
int x,
int s,
int ac)
II
private int II(int a,
int b,
int c,
int d,
int x,
int s,
int ac)
transform
void transform(byte[] buf,
int offset)
- This is where the functions come together as the generic MD5
transformation operation, it is called by update() which is
synchronized (to protect transformBuffer)
init
public void init()
- Initialize the MD5 state information and reset the bit count
to 0. Given this implementation you are constrained to counting
2^64 bits.
- Specified by:
init in class MessageDigest
update
public void update(byte b)
- update adds the passed type to the input buffer
- Specified by:
update in class MessageDigest
finish
public void finish()
- Perform the final computations, any buffered bytes are added
to the digest, the count is added to the digest, and the resulting
digest is stored. After calling final you will need to call
init() again to do another digest.
- Specified by:
finish in class MessageDigest
getAlg
public java.lang.String getAlg()
- Description copied from class:
MessageDigest
- Return a string that represents the algorithim of this
message digest.
- Specified by:
getAlg in class MessageDigest