Class BrokenMd5Hasher

java.lang.Object
com.biglybt.core.util.BrokenMd5Hasher

public final class BrokenMd5Hasher extends 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 $
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final ByteBuffer
     
    private long
     
    private int
     
    private int
     
    private int
     
    private int
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructor returns a MD6 ready for use.
  • Method Summary

    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
    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
    Resets the MD5 to initial state for a new message digest calculation.
    private void
     
    void
    update(byte[] data)
     
    void
    Starts or continues a MD5 message digest calculation.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • buffer

      private final ByteBuffer 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

      public void update(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(ByteBuffer digest)
      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

      private void transform(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)