org.jabber.jabberbeans.util
Class SHA1Helper

java.lang.Object
  |
  +--org.jabber.jabberbeans.util.SHA1Helper

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.

Version:
$Revision: 1.1.1.1 $
Author:
David Waite <dwaite@jabber.com>, $Author: lucky $
See Also:
Serialized Form

Field Summary
private static char[] HEX
          quick array to convert byte values to hex codes
private  java.security.MessageDigest md
          Message digest object
 
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, registerNatives, toString, wait, wait, wait
 

Field Detail

md

private final java.security.MessageDigest md
Message digest object

HEX

private static final char[] HEX
quick array to convert byte values to hex codes
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.