The function-based SHA256 interface uses three functions. Call the function sha256BlockBegin() to start computing a new hash, the function sha256BlockUpdate() to incorporate some more data into the hash, and the function sha256BlockEnd() to obtain the hash.
Note that the current interface can only perform the computation on a byte stream. This can be changed to a bit stream, the hashing thread itself works on a bit stream already, it just requires a different set of functions.
This is one of three functions that comprise the function based interface to the SHA256 library.
It must be called to initialise the hash.
Parameters: |
|
---|
This is one of three functions that comprise the function based interface to the SHA256 library.
It is called to incorporate data into the hash. THe data is supplied as an array of unsigned characters (bytes).
Parameters: |
|
---|
This is one of three functions that comprise the function based interface to the SHA256 library.
It completes the hash by incorporating a trailing ‘1’, padding, and the length of the message. On return of this function the array passed as the first argument holds the hash.
Parameters: |
|
---|
An example program is shown below:
int main(void) {
unsigned int hash[8];
sha256BlockStart(hash);
sha256BlockUpdate(hash, "Hello", 5);
sha256BlockEnd(hash);
return 0;
}