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()
-
SHAOutputStream()
- Creates a new SHAOutputStream.
-
getHash()
- Computes the final hash and returns the final value as a
byte[20] array.
-
reset()
- Resets the buffers and hash value to start a new hash.
-
write(byte[], int, int)
- Writes bytes to the buffer.
-
write(int)
- Writes a byte to the buffer.
SHAOutputStream
public SHAOutputStream()
- Creates a new SHAOutputStream.
write
public void write(int b)
- Writes a byte to the buffer.
- Parameters:
- b - the byte
- Overrides:
- write in class OutputStream
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
reset
public void reset()
- Resets the buffers and hash value to start a new hash.
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