org.openuat.util
Class Hash

java.lang.Object
  extended by org.openuat.util.Hash

public class Hash
extends java.lang.Object

This is a small helper class that implements SHAd-256, a double execution of SHA256 to counter extension attacks. It is defined in Niels Ferguson, Bruce Schneier: Practical Cryptography, Wiley 2003

Version:
1.0
Author:
Rene Mayrhofer

Constructor Summary
Hash()
           
 
Method Summary
static byte[] doubleSHA256(byte[] text, boolean useJSSE)
          This is a small utility function for computing a secure hash from the shared key.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Hash

public Hash()
Method Detail

doubleSHA256

public static byte[] doubleSHA256(byte[] text,
                                  boolean useJSSE)
                           throws InternalApplicationException
This is a small utility function for computing a secure hash from the shared key.

Parameters:
text - The text to hash, it may be of arbitrary length.
useJSSE - If set to true, the JSSE API with the default JCE provider of the JVM will be used for cryptographic operations. If set to false, an internal copy of the Bouncycastle Lightweight API classes will be used.
Returns:
The SHAd-256 hash over text.
Throws:
InternalApplicationException


2005-2006, Rene Mayrhofer.