net.wimpi.pim.util
Class MD5

java.lang.Object
  |
  +--net.wimpi.pim.util.MD5

public final class MD5
extends java.lang.Object

A class implements the MD5 algorithm.

The MD5 algorithm is described in RFC 1321. There are numerous implementations out there, this one was tuned specifically for hashing short strings (i.e. passwords).

It is not recommend to use this implementation for anything else but that.

Version:
0.1 (22/07/2003)
Author:
Dieter Wimberger

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 long hashValue(byte[] msg, boolean high)
           
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.

Returns:
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).

Parameters:
msg - the byte[] to be digested.
Returns:
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[].

Parameters:
data - the array of bytes to be converted into a hex-string.
Returns:
the generated hexadecimal representation as String.

hashValue

public static final long hashValue(byte[] msg,
                                   boolean high)

main

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



Copyright © 2001-2003 jpim team.