3.5.2.4 Crypto_Hash_Blake_Final
crypto_HandlerType_E Crypto_Hash_Blake_Final(
st_Crypto_Hash_Blake_Ctx *ptr_blakeCtx_st,
uint8_t *ptr_digest
);
Description
This API is used to get the calculated hash/digest for different variants BLAKE algorithms in multi-steps. Initialize context by calling Crypto_Hash_Blake_Init function and calculate hash using Crypto_Hash_Blake_Update and then call this function.
Parameters
No. | Argument Type | Argument Name | Type | Description |
---|---|---|---|---|
1 | st_Crypto_Hash_Blake_Ctx | *ptr_blakeCtx_st | Input | BLAKE variant 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;
crypto_Hash_Algo_E blakeAlgorithm_en = CRYPTO_HASH_BLAKE2B;
st_Crypto_Hash_Blake_Ctx Hash_Ctx;
uint8_t inputData[32] = {/*data*/};
uint32_t dataLen = sizeof(inputData);
uint8_t digest[64];
uint32_t digestLen = sizeof(outData);
uint8_t key[64] = {/*data*/};
uint32_t keyLen = sizeof(key);
status = Crypto_Hash_Blake_Init(
&Hash_Ctx,
blakeAlgorithm_en,
key,
keyLen,
digestLen,
handlerType_en,
sessionID
);
status = Crypto_Hash_Blake_Update(
&Hash_Ctx,
inputData,
dataLen
);
status = Crypto_Hash_Blake_Final(
&Hash_Ctx,
digest
);