All Packages This Package Class Hierarchy Class Search Index
Class edu.utah.janos.ants.utils.MD5
java.lang.Object
|
+----edu.utah.janos.ants.utils.MD5
public final class MD5
extends java.lang.Object
{
// Fields 5
private final byte[] buffer;
private final int[] count;
private static final byte[] padding;
private final int[] state;
private final int[] tx;
// Constructors 1
public MD5();
// Methods 14
private static int FF(int, int, int, int, int, int, int);
private static int GG(int, int, int, int, int, int, int);
private static int HH(int, int, int, int, int, int, int);
private static int II(int, int, int, int, int, int, int);
public static byte[] hash(byte[]);
public static byte[] hash(byte[], int, int);
private static byte[] ints2bytes(int[]);
private static int rotleft(int, int);
public static String toString(byte[]);
public byte[] hash();
private void transform(byte[], int);
public void update(byte[]);
public void update(byte[], int, int);
public void update(String);
}
Implementation of RSA's MD5 hash generator
This code is loosely based on the RSA reference implementation
and an early Java port of it by Santeri Paavolainen.
Objects of this class are single use only -- clients must
ensure that only one hash is computed, and sequentially too.
Hashes are returned as an array of 16 bytes.
Usage:
byte[] hash = MD5.hash(bytes); // single pass mode
or
MD5 digest = new MD5(); // multiple pass mode
digest.update(bytes);
digest.update(morebytes);
byte[] hash = digest.hash();
(Pat) Optimizations: combine all of the arrays into a single array
and use fixed offsets.
- Author:
-
David Wetherall (djw@lcs.mit.edu)
private final int[] state
128-bit state
private final int[] tx
64-byte transform pass
private final int[] count
64-bit character count
private final byte[] buffer
64-byte overflow buffer
private static final byte[] padding
public MD5()
private static int rotleft(int x,
int n)
private static int FF(int a,
int b,
int c,
int d,
int x,
int s,
int ac)
private static int GG(int a,
int b,
int c,
int d,
int x,
int s,
int ac)
private static int HH(int a,
int b,
int c,
int d,
int x,
int s,
int ac)
private static int II(int a,
int b,
int c,
int d,
int x,
int s,
int ac)
private void transform(byte[] buf,
int shift)
public void update(byte[] buf,
int offset,
int length)
public void update(byte[] buf)
public void update(String s)
private static byte[] ints2bytes(int[] input)
public byte[] hash()
public static byte[] hash(byte[] buf,
int off,
int len)
public static byte[] hash(byte[] buf)
public static String toString(byte[] hash)
All Packages This Package Class Hierarchy Class Search Index
Freshly brewed Java API Documentation automatically generated with polardoc Version 1.0.7