- All Implemented Interfaces:
- SHA1_Data
public class SHA1Impl
extends Object
implements SHA1_Data
This class contains methods providing SHA-1 functionality to use in classes.
The methods support the algorithm described in "SECURE HASH STANDARD", FIPS PUB 180-2,
"http://csrc.nist.gov/publications/fips/fips180-2/fips180-2.pdf"
The class contains two package level access methods, -
"void updateHash(int[], byte[], int, int)" and "void computeHash(int[])", -
performing the following operations.
The "updateHash(..)" method appends new bytes to existing ones
within limit of a frame of 64 bytes (16 words).
Once a length of accumulated bytes reaches the limit
the "computeHash(int[])" method is invoked on the frame to compute updated hash,
and the number of bytes in the frame is set to 0.
Thus, after appending all bytes, the frame contain only those bytes
that were not used in computing final hash value yet.
The "computeHash(..)" method generates a 160 bit hash value using
a 512 bit message stored in first 16 words of int[] array argument and
current hash value stored in five words, beginning HASH_OFFSET, of the array argument.
Computation is done according to SHA-1 algorithm.
The resulting hash value replaces the previous hash value in the array;
original bits of the message are not preserved.