org.norther.tammi.acorn.security
Class Digester

java.lang.Object
  extended by org.norther.tammi.acorn.security.Digester

public abstract class Digester
extends Object

A static digester for computing encoded hashs.

Author:
Ilkka Priha

Constructor Summary
Digester()
           
 
Method Summary
static String digest(String algorithm, String string)
          Computes a hash for the given string by applying platform's default encoding and returns the result as a BASE64 or MD5 encoded string depending on the algorithm.
static String digest(String algorithm, String string, String encoding)
          Computes a hash for the given string by applying the specified encoding and returns the result as a BASE64 or MD5 encoded string depending on the algorithm.
static String digest(String algorithm, String salt, String string, String encoding)
          Computes a hash for the given string by using the given salt and by applying the specified encoding and returns the result as a BASE64 or MD5 encoded string depending on the algorithm.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Digester

public Digester()
Method Detail

digest

public static final String digest(String algorithm,
                                  String string)
                           throws NoSuchAlgorithmException
Computes a hash for the given string by applying platform's default encoding and returns the result as a BASE64 or MD5 encoded string depending on the algorithm.

Parameters:
algorithm - the digest algorithm.
string - the string to use.
Returns:
the BASE64 or MD5 encoded hash.
Throws:
NoSuchAlgorithmException - if the algorithm is unknown.

digest

public static final String digest(String algorithm,
                                  String string,
                                  String encoding)
                           throws NoSuchAlgorithmException
Computes a hash for the given string by applying the specified encoding and returns the result as a BASE64 or MD5 encoded string depending on the algorithm.

Parameters:
algorithm - the digest algorithm.
string - the string to use.
encoding - the character encoding.
Returns:
the BASE64 or MD5 encoded hash.
Throws:
NoSuchAlgorithmException - if the algorithm is unknown.

digest

public static final String digest(String algorithm,
                                  String salt,
                                  String string,
                                  String encoding)
                           throws NoSuchAlgorithmException
Computes a hash for the given string by using the given salt and by applying the specified encoding and returns the result as a BASE64 or MD5 encoded string depending on the algorithm.

Parameters:
algorithm - the digest algorithm.
salt - the salt to use.
string - the string to use.
encoding - the character encoding.
Returns:
the BASE64 or MD5 encoded hash.
Throws:
NoSuchAlgorithmException - if the algorithm is unknown.


Copyright © 2004 The Norther Organization. All rights reserved.