com.intel.crypto
Interface Hash
- All Known Implementing Classes:
- HashAlg
public interface Hash
This interface represents a hash algorithm. This interface supports:
- Sequential operations where the data is processed in chunks by calling the
interface several times (see the
processUpdate
method). - Stateless operations where all data is processed in one method call.
Method Summary | |
---|---|
short |
getHashAlg()
Returns the hash algorithm used by this hash instance. |
short |
getHashLength()
Returns the length of the hash computed using this hash instance. |
short |
processComplete(byte[] input,
short inputIndex,
short inputLength,
byte[] outputArray,
short outputIndex)
Hashes the provided input data and returns the resultant hash. |
void |
processUpdate(byte[] input,
short inputIndex,
short inputLength)
Hashes the provided input data and saves the intermediate hash result in the internal context of the instance. |
Method Detail |
---|
getHashLength
short getHashLength()
- Returns the length of the hash computed using this hash instance.
- Returns:
- The length of the resultant hash in bytes.
getHashAlg
short getHashAlg()
- Returns the hash algorithm used by this hash instance.
- Returns:
- The hash algorithm used.
processUpdate
void processUpdate(byte[] input, short inputIndex, short inputLength)
- Hashes the provided input data and saves the intermediate hash result in the
internal context of the instance. The
processComplete
method must be called to complete the hashing sequence.- Parameters:
input
- the input data to hashinputIndex
- index in the input arrayinputLength
- input data length
processComplete
short processComplete(byte[] input, short inputIndex, short inputLength, byte[] outputArray, short outputIndex) throws CryptoException
- Hashes the provided input data and returns the resultant hash. If available,
the final hash computation also includes intermediate hash results from any previous calls
to the
processUpdate
method. This method also resets the internal state of the instance and makes the instance ready to start a new hashing sequence.- Parameters:
input
- the input data to hashinputIndex
- index in the input arrayinputLength
- input data lengthoutputArray
- output array to hold the hash resultoutputIndex
- index in the output array- Returns:
- The resultant hash length in bytes.
- Throws:
IllegalUseException
- if data was not provided in the input buffer or via any prior calls to theprocessUpdate
method.CryptoException