info.magnolia.cms.security
Class Digester

java.lang.Object
  extended by info.magnolia.cms.security.Digester

public final class Digester
extends Object

Encryption helper. Supported algorithm:

Future:

Version:
2.0
Author:
Sameer Charles

Field Summary
static String MD5
           
static String SHA1
           
static String SHA256
          There are five (5) FIPS-approved* algorithms for generating a condensed representation of a message (message digest): SHA-1, SHA-224, SHA-256,SHA-384, and SHA-512.
static String SHA384
           
static String SHA512
           
 
Method Summary
static byte[] getDigest(byte[] data, String algorithm)
           
static String getDigest(String data, String algorithm)
           
static String getMD5Hex(String data)
          Gets MD5 encoded -> hex string.
static String getSHA1Hex(String data)
          Gets SHA-1 encoded -> hex string.
static String toHEX(byte[] data)
          Converts a byte array to a string Hex.
static String toHEX(String data)
          Converts a byte array to a string Hex.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SHA1

public static final String SHA1
See Also:
Constant Field Values

MD5

public static final String MD5
See Also:
Constant Field Values

SHA256

public static final String SHA256
There are five (5) FIPS-approved* algorithms for generating a condensed representation of a message (message digest): SHA-1, SHA-224, SHA-256,SHA-384, and SHA-512. Not supported yet

See Also:
Constant Field Values

SHA384

public static final String SHA384
See Also:
Constant Field Values

SHA512

public static final String SHA512
See Also:
Constant Field Values
Method Detail

getDigest

public static String getDigest(String data,
                               String algorithm)
                        throws NoSuchAlgorithmException
Throws:
NoSuchAlgorithmException

getDigest

public static byte[] getDigest(byte[] data,
                               String algorithm)
                        throws NoSuchAlgorithmException
Throws:
NoSuchAlgorithmException

getSHA1Hex

public static String getSHA1Hex(String data)
Gets SHA-1 encoded -> hex string.


getMD5Hex

public static String getMD5Hex(String data)
Gets MD5 encoded -> hex string.


toHEX

public static String toHEX(String data)
Converts a byte array to a string Hex.

Parameters:
data - to be converted
Returns:
string representing hex values of the byte array

toHEX

public static String toHEX(byte[] data)
Converts a byte array to a string Hex.

Parameters:
data - to be converted
Returns:
string representing hex values of the byte array


Copyright © 2003-2012 Magnolia International Ltd.. All Rights Reserved.