org.beepcore.beep.profile.sasl.otp.algorithm
Class AlgorithmImpl

java.lang.Object
  |
  +--org.beepcore.beep.profile.sasl.otp.algorithm.AlgorithmImpl
All Implemented Interfaces:
Algorithm
Direct Known Subclasses:
MD5, SHA1

public abstract class AlgorithmImpl
extends java.lang.Object
implements Algorithm


Field Summary
 
Fields inherited from interface org.beepcore.beep.profile.sasl.otp.algorithm.Algorithm
ERR_HASH_FAILURE
 
Constructor Summary
AlgorithmImpl(java.lang.String internal)
          Method AlgorithmImpl
 
Method Summary
protected abstract  byte[] foldHash(byte[] hash)
          Method foldHash is provided for implementations, as the value of the message digest hash must be folding into 64 bits before it can be used by the SASLOTPProfile and its supporting classes.
 byte[] generateHash(byte[] data)
          Method generateHash generate a hash value using the appropriate hash function.
 byte[] generateHash(java.lang.String s)
          Method generateHash generate a hash value using the appropriate hash function.
abstract  java.lang.String getName()
          Method getName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AlgorithmImpl

public AlgorithmImpl(java.lang.String internal)
Method AlgorithmImpl

Method Detail

getName

public abstract java.lang.String getName()
Method getName

Specified by:
getName in interface Algorithm

generateHash

public byte[] generateHash(java.lang.String s)
                    throws InvalidParameterException
Method generateHash generate a hash value using the appropriate hash function.

Specified by:
generateHash in interface Algorithm
Returns:
byte[] the hash value in binary form.
Throws:
SASLException - if an error is encountered during the generation of hte hash.
InvalidParameterException

generateHash

public byte[] generateHash(byte[] data)
                    throws InvalidParameterException
Method generateHash generate a hash value using the appropriate hash function.

Specified by:
generateHash in interface Algorithm
Returns:
byte[] the hash value in binary form.
Throws:
SASLException - if an error is encountered during the generation of hte hash.
InvalidParameterException

foldHash

protected abstract byte[] foldHash(byte[] hash)
                            throws InvalidParameterException
Method foldHash is provided for implementations, as the value of the message digest hash must be folding into 64 bits before it can be used by the SASLOTPProfile and its supporting classes.

Returns:
byte[] is the folded hash.
Throws:
InvalidParameterException - of the has provided is somehow improper or invalid.


Copyright ? 2001 Invisible Worlds, Inc. All Rights Reserved.