Package com.biglybt.core.util
Class BrokenMd5Hasher
- java.lang.Object
-
- com.biglybt.core.util.BrokenMd5Hasher
-
public final class BrokenMd5Hasher extends java.lang.Object
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 $
-
-
Constructor Summary
Constructors Constructor Description BrokenMd5Hasher()
Constructor returns a MD6 ready for use.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]
calculateHash(byte[] data)
private static int
FF(int a, int b, int c, int d, int x, int s, int t)
void
finalDigest(java.nio.ByteBuffer digest)
Finishs a MD5 message digest calculation.byte[]
getDigest()
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(java.nio.ByteBuffer block)
void
update(byte[] data)
void
update(java.nio.ByteBuffer input)
Starts or continues a MD5 message digest calculation.
-
-
-
Method Detail
-
calculateHash
public byte[] calculateHash(byte[] data)
-
reset
public void reset()
Resets the MD5 to initial state for a new message digest calculation.
-
update
public void update(java.nio.ByteBuffer input)
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
public void finalDigest(java.nio.ByteBuffer digest)
Finishs a 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
private void transform(java.nio.ByteBuffer block)
-
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)
-
-