ants.util
Class MD5
java.lang.Object
|
+--ants.util.MD5
- public final class MD5
- extends java.lang.Object
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();
XXX Optimizations: combine all of the arrays into a single array
and use fixed offsets.
- Author:
- David Wetherall
Constructor Summary |
MD5()
|
Method Summary |
byte[] |
hash()
|
static byte[] |
hash(byte[] buf)
|
static byte[] |
hash(byte[] buf,
int off,
int len)
|
static java.lang.String |
toShortString(byte[] hash)
|
static java.lang.String |
toString(byte[] hash)
|
void |
update(byte[] buf)
|
void |
update(byte[] buf,
int offset,
int length)
|
void |
update(java.lang.String s)
|
Methods inherited from class java.lang.Object |
equals,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
MD5
public MD5()
update
public void update(byte[] buf,
int offset,
int length)
update
public void update(byte[] buf)
update
public void update(java.lang.String s)
hash
public byte[] hash()
hash
public static byte[] hash(byte[] buf,
int off,
int len)
hash
public static byte[] hash(byte[] buf)
toString
public static java.lang.String toString(byte[] hash)
toShortString
public static java.lang.String toShortString(byte[] hash)
This documentation is Copyright (C) 1998-2001 The University of Utah and the University of Washington. All Rights Reserved. See the individual source files for distribution terms.
Documentation, software, and mailing lists for ANTS v2.0 can be found at the Janos Project: http://www.cs.utah.edu/flux/janos/