org.jabber.jabberbeans.util
Class SHA1Helper

java.lang.Object
  |
  +--org.jabber.jabberbeans.util.SHA1Helper
All Implemented Interfaces:
java.io.Serializable

public class SHA1Helper
extends java.lang.Object
implements java.io.Serializable

A SHA1Helper is used for authentication for users and component authentication. It is simply a wrapper around MessageDigest to give a simplified interface for performing the hashing.

See Also:
Serialized Form

Constructor Summary
SHA1Helper()
          Creates a new MessageDigest instance.
 
Method Summary
static java.lang.String bytesToHex(byte[] data)
          This utility method is passed an array of bytes.
 java.lang.String digest(java.lang.String identifier, java.lang.String key)
          used to hash passwords and other key data to send over the wire, to prevent plaintext transmit.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SHA1Helper

public SHA1Helper()
           throws java.lang.InstantiationException
Creates a new MessageDigest instance.

Method Detail

digest

public java.lang.String digest(java.lang.String identifier,
                               java.lang.String key)
used to hash passwords and other key data to send over the wire, to prevent plaintext transmit.

Parameters:
identifier - prefix, such as the SessionID
key - passkey, such as password or handshake
Returns:
String with the hash in hex string form

bytesToHex

public static java.lang.String bytesToHex(byte[] data)
This utility method is passed an array of bytes. It returns this array as a String in hexadecimal format. This is used internally by digest(). Data is returned in the format specified by the Jabber protocol.