1.70 CRYPT_SHA512_Initialize Function

C

int CRYPT_SHA512_Initialize(
    CRYPT_SHA512_CTX* sha512
);

Description

This function initializes the internal structures necessary for SHA512 hash calculations.

Preconditions

None.

Parameters

ParametersDescription
sha512Pointer to CRYPT_SHA512_CTX structure which holds the hash values.

Returns

  • BAD_FUNC_ARG - An invalid pointer was passed to the function.

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

Remarks

All SHA512 hashes have to start at a particular value before adding new data to it. This function sets the necessary values for the structure.

Example

CRYPT_SHA512_CTX sha512;
uint8_t sha512Sum[SHA512_DIGEST_SIZE];

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