Skip to content

Latest commit

 

History

History
48 lines (29 loc) · 1003 Bytes

GUID-1B07E8A4-54A0-409A-8443-0DD9E5A88BDC.md

File metadata and controls

48 lines (29 loc) · 1003 Bytes

CRYPT_SHA512_Initialize Function

Parent topic:MPLAB® Harmony Crypto Library

C

int CRYPT_SHA512_Initialize(
    CRYPT_SHA512_CTX* sha512
);

Description

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

Preconditions

None.

Parameters

Parameters Description
sha512 Pointer 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);