org.fhw.cabaweb.tools
Class MD5
java.lang.Object
org.fhw.cabaweb.tools.MD5
- public class MD5
- extends Object
Klasse um MD5 Hashes zu erstellen.
Originalklasse von Jon Howell - mit kleinen Änderungen von Thomas Vogt
This class computes MD5 hashes.
Manually translated by Jon Howell
from some public domain C code (md5.c) included with the ssh-1.2.22 source.
Tue Jan 19 15:55:50 EST 1999
$Id: MD5.java,v 1.2 2004/11/11 08:44:25 cabaweb Exp $
To compute the message digest of a chunk of bytes, create an
MD5 object 'md5', call md5.update() as needed on buffers full
of bytes, and then call md5.md5final(), which
will fill a supplied 16-byte array with the digest.
A main() method is included that hashes the data on System.in.
It seems to run around 25-30 times slower (JDK1.1.6) than optimized C
(gcc -O4, version 2.7.2.3). Measured on a Sun Ultra 5 (SPARC 270MHz).
Comments from md5.c from ssh-1.2.22, the basis for this code:
This code has been heavily hacked by Tatu Ylonen to
make it compile on machines like Cray that don't have a 32 bit integer
type.
This code implements the MD5 message-digest algorithm.
The algorithm is due to Ron Rivest. This code was
written by Colin Plumb in 1993, no copyright is claimed.
This code is in the public domain; do with it what you wish.
Equivalent code is available from RSA Data Security, Inc.
This code has been tested against that, and is equivalent,
except that you don't need to include two pages of legalese
with every copy.
To compute the message digest of a chunk of bytes, declare an
MD5Context structure, pass it to MD5Init, call MD5Update as
needed on buffers full of bytes, and then call MD5Final, which
will fill a supplied 16-byte array with the digest.
- Version:
- 19.01.1999 21:30:11 - Changes 10.03.2004
- Author:
- Jon Howell
Constructor Summary |
MD5()
Konstruktor |
Method Summary |
String |
dumpBytes(byte[] bytes)
No Comment |
void |
md5final(byte[] digest)
Final wrapup - pad to 64-byte boundary with the bit pattern
1 0* (64-bit count of bits processed, MSB-first) |
void |
update(byte[] newbuf)
No Comment |
void |
update(byte[] newbuf,
int length)
No Comment |
void |
update(byte[] newbuf,
int bufstart,
int buflen)
No Comment |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
MD5
public MD5()
- Konstruktor
update
public void update(byte[] newbuf)
- No Comment
update
public void update(byte[] newbuf,
int length)
- No Comment
update
public void update(byte[] newbuf,
int bufstart,
int buflen)
- No Comment
md5final
public void md5final(byte[] digest)
- Final wrapup - pad to 64-byte boundary with the bit pattern
1 0* (64-bit count of bits processed, MSB-first)
dumpBytes
public String dumpBytes(byte[] bytes)
- No Comment
Copyright © 2004 TVC-Software.com. All Rights Reserved.