com.ibm.security12.sun.security.provider
Class SHA

java.lang.Object
  |
  +--com.ibm.security12.java.security.MessageDigestSpi
        |
        +--com.ibm.security12.sun.security.provider.SHA

public class SHA
extends MessageDigestSpi
implements Cloneable

This class implements the Secure Hash Algorithm (SHA) developed by the National Institute of Standards and Technology along with the National Security Agency. This is the updated version of SHA fip-180 as superseded by fip-180-1.

It implement JavaSecurity MessageDigest, and can be used by in the Java Security framework, as a pluggable implementation, as a filter for the digest stream classes.

Version:
1.31 98/07/22
Author:
Roger Riggs, Benjamin Renaud

Constructor Summary
SHA()
          Creates a new SHA object.
 
Method Summary
 Object clone()
           
 byte[] engineDigest()
          Computes the final hash and returns the final value as a byte[20] array.
 int engineDigest(byte[] hashvalue, int offset, int len)
          Computes the final hash and returns the final value as a byte[20] array.
protected  int engineGetDigestLength()
          Return the length of the digest in bytes
 void engineReset()
          Resets the buffers and hash value to start a new hash.
 void engineUpdate(byte b)
           
 void engineUpdate(byte[] b, int off, int len)
          Update a buffer.
 void init()
          Resets the buffers and hash value to start a new hash.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SHA

public SHA()
Creates a new SHA object.
Method Detail

engineGetDigestLength

protected int engineGetDigestLength()
Return the length of the digest in bytes
Overrides:
engineGetDigestLength in class MessageDigestSpi

engineUpdate

public void engineUpdate(byte b)
Overrides:
engineUpdate in class MessageDigestSpi

engineUpdate

public void engineUpdate(byte[] b,
                         int off,
                         int len)
Update a buffer.
Parameters:
b - the data to be updated.
off - the start offset in the data
len - the number of bytes to be updated.
Overrides:
engineUpdate in class MessageDigestSpi

init

public void init()
Resets the buffers and hash value to start a new hash.

engineReset

public void engineReset()
Resets the buffers and hash value to start a new hash.
Overrides:
engineReset in class MessageDigestSpi

engineDigest

public byte[] engineDigest()
Computes the final hash and returns the final value as a byte[20] array. The object is reset to be ready for further use, as specified in the JavaSecurity MessageDigest specification.
Overrides:
engineDigest in class MessageDigestSpi

engineDigest

public int engineDigest(byte[] hashvalue,
                        int offset,
                        int len)
                 throws DigestException
Computes the final hash and returns the final value as a byte[20] array. The object is reset to be ready for further use, as specified in the JavaSecurity MessageDigest specification.
Overrides:
engineDigest in class MessageDigestSpi

clone

public Object clone()
Overrides:
clone in class MessageDigestSpi