org.globalse.arena.frag.security
Class MD5Hash

java.lang.Object
  |
  +--org.globalse.arena.frag.security.MD5Hash

public class MD5Hash
extends java.lang.Object

This class creates an MD5 hash from a string (password for example). To get an instance of the class use the getInstance() method. To hash a string use hashData() Method. $Id: MD5Hash.html,v 1.1 2003/02/12 18:06:20 schoecke Exp $


Method Summary
static MD5Hash getInstance()
          This returns the singleton instance of the class
 java.lang.String hashData(byte[] dataToHash)
          The main method of the class which needs to be called for hashing the data
 java.lang.String hexStringFromBytes(byte[] b)
          Calculates hexadecimal value of the hash from the byte array of the hashed data
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static MD5Hash getInstance()
                           throws java.security.NoSuchAlgorithmException
This returns the singleton instance of the class
Returns:
an instance of the class
Throws:
java.security.NoSuchAlgorithmException - needed by the java api's

hashData

public java.lang.String hashData(byte[] dataToHash)
The main method of the class which needs to be called for hashing the data
Parameters:
dataToHash - byte[] data for hashing
Returns:
a String with the hash code

hexStringFromBytes

public java.lang.String hexStringFromBytes(byte[] b)
Calculates hexadecimal value of the hash from the byte array of the hashed data
Parameters:
b - bytes[] bytes which are transformed in hex.
Returns:
a string of the hexadecimal value of the hash



This page is hosted by the Chair for Applied Software Engineering of the Technische Universität München.
Imprint (Impressum)