SalesPoint Framework v3.1

users
Class MD5

java.lang.Object
  extended byusers.MD5

public final class MD5
extends Object

An class for generating a securly encoded passwort string using the MD5 algorithm

Author:
Alexander Herrmann

Constructor Summary
MD5()
           
 
Method Summary
static String byteToHex(byte[] b)
          Converts a byte-Array to hexadecimal string
static byte[] digestBytes(byte[] bData)
          Retrieves a byte sequence representing the MD5 digest of the specified byte sequence.
static byte[] digestString(String sPhrase)
          Retrieves a byte sequence that represents the MD5 digest string.
static String encodeString(String sPhrase)
          Retrieves a hexadecimal character sequence representing the MD5 digest of the specified character sequence by using ISO-8859-1 encoding
 
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

encodeString

public static final String encodeString(String sPhrase)
                                 throws RuntimeException
Retrieves a hexadecimal character sequence representing the MD5 digest of the specified character sequence by using ISO-8859-1 encoding

Parameters:
sPhrase - the string to encode.
Returns:
a hexadecimal character sequence representing the MD5 digest of the specified string
Throws:
RuntimeException - if an MD5 digest algorithm is not available through the java.security.MessageDigest spi

byteToHex

public static String byteToHex(byte[] b)
Converts a byte-Array to hexadecimal string

Parameters:
b - the byte[] to be converted
Returns:
hexadecimal string

digestString

public static byte[] digestString(String sPhrase)
                           throws RuntimeException
Retrieves a byte sequence that represents the MD5 digest string. Used encoding is ISO-8859-1

Parameters:
sPhrase - the string to digest.
Returns:
the digest as an array of 16 bytes.
Throws:
RuntimeException - if an MD5 digest algorithm is not available through the java.security.MessageDigest spi

digestBytes

public static final byte[] digestBytes(byte[] bData)
                                throws RuntimeException
Retrieves a byte sequence representing the MD5 digest of the specified byte sequence.

Parameters:
bData - the data to digest.
Returns:
the MD5 digest as an array of 16 bytes.
Throws:
RuntimeException - if an MD5 digest algorithm is not available through the java.security.MessageDigest spi

SalesPoint Framework v3.1