org.clazzes.optional.sec
Class GeneralDigest

java.lang.Object
  extended by org.clazzes.optional.sec.GeneralDigest
All Implemented Interfaces:
Digest
Direct Known Subclasses:
SHA1Digest, SHA256Digest

public abstract class GeneralDigest
extends java.lang.Object
implements Digest

Base class for the most common digests. This class is imported from bouncycastle.org


Constructor Summary
protected GeneralDigest()
          Standard constructor
protected GeneralDigest(GeneralDigest t)
          Copy constructor.
 
Method Summary
 void finish()
           
 int getByteLength()
          Return the size in bytes of the internal buffer the digest applies it's compression function to.
protected abstract  void processBlock()
           
protected abstract  void processLength(long bitLength)
           
protected abstract  void processWord(byte[] in, int inOff)
           
 void reset()
          Reset the hash in order to reuse this instance.
 void update(byte in)
          update the message digest with a single byte.
 void update(byte[] in, int inOff, int len)
          Add more data to the hash function.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.clazzes.optional.sec.Digest
cloneState, doFinal, getAlgorithmName, getDigestSize
 

Constructor Detail

GeneralDigest

protected GeneralDigest()
Standard constructor


GeneralDigest

protected GeneralDigest(GeneralDigest t)
Copy constructor. We are using copy constructors in place of the Object.clone() interface as this interface is not supported by J2ME.

Method Detail

update

public void update(byte in)
Description copied from interface: Digest
update the message digest with a single byte.

Specified by:
update in interface Digest
Parameters:
in - the input byte to be entered.

update

public void update(byte[] in,
                   int inOff,
                   int len)
Description copied from interface: Digest
Add more data to the hash function.

Specified by:
update in interface Digest
Parameters:
in - The buffer where the data to add is stored. length bytes starting with off will be written.
inOff - The offset at which the data is stored.
len - The number of bytes to add.

finish

public void finish()

reset

public void reset()
Description copied from interface: Digest
Reset the hash in order to reuse this instance.

Specified by:
reset in interface Digest

getByteLength

public int getByteLength()
Description copied from interface: Digest
Return the size in bytes of the internal buffer the digest applies it's compression function to.

Specified by:
getByteLength in interface Digest
Returns:
byte length of the digests internal buffer.

processWord

protected abstract void processWord(byte[] in,
                                    int inOff)

processLength

protected abstract void processLength(long bitLength)

processBlock

protected abstract void processBlock()


Copyright © 2010. All Rights Reserved.