Skip to content

Latest commit

 

History

History
51 lines (32 loc) · 1.23 KB

GUID-24F8B427-FBDD-40C3-948F-9C0C59008DBD.md

File metadata and controls

51 lines (32 loc) · 1.23 KB

CRYPT_SHA224_Finalize Function

Parent topic:MPLAB® Harmony Crypto Library

C

int CRYPT_SHA224_Finalize(
    CRYPT_SHA256_CTX* sha224, 
    unsigned char* digest
);

Description

This function finalizes the hash and puts the result into digest.

Preconditions

The SHA224 context must be initialized prior to calling this function. The context must not be modified by code outisde of this function.

Parameters

Parameters Description
sha224 Pointer to CRYPT_SHA256_CTX structure which holds the hash values.
digest Pointer to byte array to store hash result.

Returns

  • BAD_FUNC_ARG - An invalid pointer was passed to the function, either sha224 or digest.

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

Remarks

In order to preserve the validity of the SHA224 hash, nothing must modify the context holding variable between calls to CRYPT_SHA224_DataAdd and CRYPT_SHA224_Finalize.

Example

CRYPT_SHA256_CTX sha224;
uint8_t buffer[1024];
uint8_t shaSum[SHA224_DIGEST_SIZE];

CRYPT_SHA224_Initialize(&sha224);
CRYPT_SHA224_DataAdd(&sha224, buffer, sizeof(buffer));
CRYPT_SHA224_Finalize(&sha224, shaSum);