Class java.io.SHAOutputStream
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class java.io.SHAOutputStream

java.lang.Object
   |
   +----java.io.OutputStream
           |
           +----java.io.SHAOutputStream

public class SHAOutputStream
extends OutputStream
This class implements the Secure Hash Algorithm (SHA) developed by the National Institute of Standards and Technology along with the National Security Agency. It is an extension of OutputStream and can be used in its place. The usual write(byte) and write(byte[], offset, len) methods are used to supply data to the stream. When used with a DataOutputStream it can be used to hash all primitive data types. The hash is retrieved with GetHash()


Constructor Index

 o SHAOutputStream()
Creates a new SHAOutputStream.

Method Index

 o getHash()
Computes the final hash and returns the final value as a byte[20] array.
 o reset()
Resets the buffers and hash value to start a new hash.
 o write(byte[], int, int)
Writes bytes to the buffer.
 o write(int)
Writes a byte to the buffer.

Constructors

 o SHAOutputStream
  public SHAOutputStream()
Creates a new SHAOutputStream.

Methods

 o write
  public void write(int b)
Writes a byte to the buffer.
Parameters:
b - the byte
Overrides:
write in class OutputStream
 o write
  public void write(byte b[],
                    int off,
                    int len)
Writes bytes to the buffer.
Parameters:
b - the data to be written
off - the start offset in the data
len - the number of bytes that are written
Overrides:
write in class OutputStream
 o reset
  public void reset()
Resets the buffers and hash value to start a new hash.
 o getHash
  public byte[] getHash()
Computes the final hash and returns the final value as a byte[20] array. The SHAOutputStream is reset() to be ready for further use.

All Packages  Class Hierarchy  This Package  Previous  Next  Index