Package com.biglybt.core.util
Class BrokenMd5Hasher
java.lang.Object
com.biglybt.core.util.BrokenMd5Hasher
Use this class for getting a MD5 message digest.
Create a MD5 and reuse it after a message digest calculation. There can be as
many MD5 objects as you want to have multiple calculations same time.
The message can be passed in one or a sequenze of parts wrapped in a
ByteBuffer to the update of the same MD5 instance. To finish the calculation
use final, it will reset the MD5 instance for a new calculation.
- Version:
- $Revision: 1.1 $
Last changed by $Author: parg $ on $Date: 2005-11-16 13:36:23 $
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbyte[]
calculateHash
(byte[] data) private static int
FF
(int a, int b, int c, int d, int x, int s, int t) void
finalDigest
(ByteBuffer digest) Finishes an MD5 message digest calculation.byte[]
private static int
GG
(int a, int b, int c, int d, int x, int s, int t) private static int
HH
(int a, int b, int c, int d, int x, int s, int t) private static int
II
(int a, int b, int c, int d, int x, int s, int t) void
reset()
Resets the MD5 to initial state for a new message digest calculation.private void
transform
(ByteBuffer block) void
update
(byte[] data) void
update
(ByteBuffer input) Starts or continues a MD5 message digest calculation.
-
Field Details
-
buffer
-
stateA
private int stateA -
stateB
private int stateB -
stateC
private int stateC -
stateD
private int stateD -
count
private long count
-
-
Constructor Details
-
BrokenMd5Hasher
public BrokenMd5Hasher()Constructor returns a MD6 ready for use.
-
-
Method Details
-
calculateHash
public byte[] calculateHash(byte[] data) -
reset
public void reset()Resets the MD5 to initial state for a new message digest calculation. -
update
Starts or continues a MD5 message digest calculation. input.remaining() should be a multiple of 64 to be most efficant, but other amounts work too. Only remaining bytes of the ByteBuffer are used and input.position() will be input.limit() after return.- Parameters:
input
- hold a part of the message. input.order() have to be ByteOrder.LITTLE_ENDIAN
-
update
public void update(byte[] data) -
getDigest
public byte[] getDigest() -
finalDigest
Finishes an MD5 message digest calculation. The result is stored in digest and the MD5-object is reset and so ready for a new message digest calculation.- Parameters:
digest
- should be a ByteBuffer with digest.remaining() >= 16
-
transform
-
FF
private static int FF(int a, int b, int c, int d, int x, int s, int t) -
GG
private static int GG(int a, int b, int c, int d, int x, int s, int t) -
HH
private static int HH(int a, int b, int c, int d, int x, int s, int t) -
II
private static int II(int a, int b, int c, int d, int x, int s, int t)
-