1.68 CRYPT_SHA512_DataAdd Function

C

int CRYPT_SHA512_DataAdd(
    CRYPT_SHA512_CTX* sha512, 
    const unsigned char* input, 
    unsigned int sz
);

Description

This function updates the hash with the data provided.

Preconditions

The SHA512 context must be initialized prior to the first call of this function. The context must not be modified by code outside of this function.

Parameters

ParametersDescription
sha512Pointer to CRYPT_SHA512_CTX structure which holds the hash values.
inputPointer to the data to use to update the hash.
szSize of the data (in bytes) to use to update the hash.

Returns

  • BAD_FUNC_ARG - An invalid pointer was passed to the function, either in sha512 or input.

  • 0 - An invalid pointer was not passed to the function.

Remarks

In order to preserve the validity of the SHA512 hash, nothing must modify the context holding variable between calls to CRYPT_SHA512_DataAdd.

Example

CRYPT_SHA512_CTX sha512;
uint8_t buffer[1024];
uint8_t sha512Sum[SHA512_DIGEST_SIZE];

CRYPT_SHA512_Initialize(&sha512);
CRYPT_SHA512_DataAdd(&sha512, buffer, sizeof(buffer));
CRYPT_SHA512_Finalize(&sha512, sha512Sum);