Jwma

dtw.webmail.util
Class MD5

java.lang.Object
  |
  +--dtw.webmail.util.MD5

public final class MD5
extends java.lang.Object

This class implements the MD5 algorithm. *

* The specification is available from RFC 1321, * and there are numerous implementations out there, * this one was tuned specifically for hashing short * strings (i.e. passwords). *

* I do not recommend to use this implementation for * anything else but that, and if anybody feels that * this code is to "close" to something available on * the net, please contact me, and I will certainly take * steps to clear up the situation.


Constructor Summary
MD5()
           
 
Method Summary
static java.lang.String asHex(byte[] data)
          Returns a String containing unsigned hexadecimal * numbers as digits.
static byte[] digest(byte[] msg)
          Returns the MD5 hash of the input data.
static java.lang.String hash(java.lang.String str)
          Returns the MD5 hash digest transformed into a hex * representation as String.
static void main(java.lang.String[] args)
          A main, to allow using this class from the command line.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MD5

public MD5()
Method Detail

hash

public static final java.lang.String hash(java.lang.String str)
Returns the MD5 hash digest transformed into a hex * representation as String. * * @return the MD5 hash of the input as String.


digest

public static final byte[] digest(byte[] msg)
Returns the MD5 hash of the input data. *

* Following the the MD5 standard specification, the result * is returned least significant byte first, however, * many applications use the most significant byte first (more conventional). * * @param msg the byte[] to be digested. * * @return the MD5 hash of the data as String.


asHex

public static final java.lang.String asHex(byte[] data)
Returns a String containing unsigned hexadecimal * numbers as digits. *

* Contains two hex digit characters for each byte from the passed in * byte[]. * * @param data the array of bytes to be converted into a hex-string. * @return the generated hexadecimal representation as * String.


main

public static void main(java.lang.String[] args)
A main, to allow using this class from the command line.


Jwma

Copyright © 2000-2003 jwma team (All Rights Reserved.)