com.internationalnetwork.security
Class Hash

Object
  extended by com.internationalnetwork.security.Hash

public class Hash
extends Object

Produces various basic types of hash values.


Field Summary
static String VERSION
          Version number of this Package (read-only).
 
Method Summary
static byte[] HMACMD5(byte[] key, byte[] challenge)
          Generates an HMAC-MD5 hash.
static byte[] HMACMD5(String key, String challenge)
          Generates an HMAC-MD5 hash.
static String HMACMD5h(byte[] key, byte[] challenge)
          Generates an HMAC-MD5 hash.
static String HMACMD5h(String key, String challenge)
          Generates an HMAC-MD5 hash.
static byte[] MD5(byte[] secret)
          Generates an MD5 hash.
static byte[] MD5(String secret)
          Generates an MD5 hash.
static String MD5h(byte[] secret)
          Generates an MD5 hash.
static String MD5h(String secret)
          Generates an MD5 hash.
static String SASLDigestResponse(String nonce, String nc, String cnonce, String qop, String realm, String username, String password, boolean rspauth, String digesturi, String authzid)
          Calculates and generates the string value for one of two of the following SASL keywords:
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VERSION

public static final String VERSION
Version number of this Package (read-only).

See Also:
Constant Field Values
Method Detail

HMACMD5

public static byte[] HMACMD5(byte[] key,
                             byte[] challenge)
Generates an HMAC-MD5 hash.

Parameters:
key - Data that is to be kept secret, such as a password
challenge - Data known by all parties that the message is scrambled with
Returns:
128-bit HMAC-MD5 hash value as a byte array
Throws:
MissingResourceException - This exception doesn't normally need to be caught because it will only be thrown if the MD5 algorithm isn't available (it's always available, so this exception should never be thrown)

HMACMD5

public static byte[] HMACMD5(String key,
                             String challenge)
Generates an HMAC-MD5 hash.

Parameters:
key - Data that is to be kept secret, such as a password
challenge - Data known by all parties that the message is scrambled with
Returns:
128-bit HMAC-MD5 hash value as a byte array
Throws:
MissingResourceException - This exception doesn't normally need to be caught because it will only be thrown if the MD5 algorithm isn't available (it's always available, so this exception should never be thrown)

HMACMD5h

public static String HMACMD5h(byte[] key,
                              byte[] challenge)
Generates an HMAC-MD5 hash.

Parameters:
key - Data that is to be kept secret, such as a password
challenge - Data known by all parties that the message is scrambled with
Returns:
128-bit HMAC-MD5 hash value as a String of hexadecimal nybbles
Throws:
MissingResourceException - This exception doesn't normally need to be caught because it will only be thrown if the MD5 algorithm isn't available (it's always available, so this exception should never be thrown)

HMACMD5h

public static String HMACMD5h(String key,
                              String challenge)
Generates an HMAC-MD5 hash.

Parameters:
key - Data that is to be kept secret, such as a password
challenge - Data known by all parties that the message is scrambled with
Returns:
128-bit HMAC-MD5 hash value as a String of hexadecimal nybbles
Throws:
MissingResourceException - This exception doesn't normally need to be caught because it will only be thrown if the MD5 algorithm isn't available (it's always available, so this exception should never be thrown)

MD5

public static byte[] MD5(byte[] secret)
Generates an MD5 hash.

Parameters:
secret - Data to generate an MD5 hash for
Returns:
128-bit MD5 hash value as a byte array
Throws:
MissingResourceException - This exception doesn't normally need to be caught because it will only be thrown if the MD5 algorithm isn't available (it's always available, so this exception should never be thrown)

MD5

public static byte[] MD5(String secret)
Generates an MD5 hash.

Parameters:
secret - Data to generate an MD5 hash for
Returns:
128-bit MD5 hash value as a byte array
Throws:
MissingResourceException - This exception doesn't normally need to be caught because it will only be thrown if the MD5 algorithm isn't available (it's always available, so this exception should never be thrown)

MD5h

public static String MD5h(byte[] secret)
Generates an MD5 hash.

Parameters:
secret - Data to generate an MD5 hash for
Returns:
128-bit MD5 hash value as a String of hexadecimal nybbles
Throws:
MissingResourceException - This exception doesn't normally need to be caught because it will only be thrown if the MD5 algorithm isn't available (it's always available, so this exception should never be thrown)

MD5h

public static String MD5h(String secret)
Generates an MD5 hash.

Parameters:
secret - Data to generate an MD5 hash for
Returns:
128-bit MD5 hash value as a String of hexadecimal nybbles
Throws:
MissingResourceException - This exception doesn't normally need to be caught because it will only be thrown if the MD5 algorithm isn't available (it's always available, so this exception should never be thrown)

SASLDigestResponse

public static String SASLDigestResponse(String nonce,
                                        String nc,
                                        String cnonce,
                                        String qop,
                                        String realm,
                                        String username,
                                        String password,
                                        boolean rspauth,
                                        String digesturi,
                                        String authzid)
Calculates and generates the string value for one of two of the following SASL keywords: