3.4.2.3 Crypto_Hash_ShakeFinal
crypto_Hash_Status_E Crypto_Hash_ShakeFinal(
st_Crypto_Hash_Shake_Ctx *ptr_shakeCtx_st,
uint8_t *ptr_digest
);
Description
This API is used to get the calculated hash/digest for different variants SHAKE algorithms in multi-steps. Initialize context by calling Crypto_Hash_Shake_Init function and calculate hash using Crypto_Hash_Shake_Update and then call this function.
Parameters
No. | Argument Type | Argument Name | Type | Description |
---|---|---|---|---|
1 | st_Crypto_Hash_Shake_Ctx | *ptr_shakeCtx_st | Input | Hash algorithm and crypto handler selection |
2 | uint8_t* | ptr_digest | Output | Pointer to store calculated digest |
Returns
Return Type | Description |
---|---|
crypto_Hash_Status_E | Function returns the status of the API. |
Example
#define sessionID 1
crypto_Hash_Status_E status;
crypto_HandlerType_E handlerType_en = CRYPTO_HANDLER_HW_INTERNAL;
st_Crypto_Hash_Sha_Ctx Hash_Ctx;
crypto_Hash_Algo_E shaAlgorithm_en = CRYPTO_HASH_SHA3_SHAKE128;
uint8_t inputData[32] = {/*data*/};
uint32_t dataLen = sizeof(inputData);
uint8_t outData[64];
uint32_t digestLen = 100;
status = Crypto_Hash_Shake_Init(
&Hash_Ctx,
shaAlgorithm_en,
handlerType_en,
digestLen,
shakeSessionId
);
status = Crypto_Hash_Shake_Update(
&Hash_Ctx,
inputData,
dataLen
);
status = Crypto_Hash_ShakeFinal(
&Hash_Ctx,
outData
);