3.5.2.1 Crypto_Hash_Blake_Digest
crypto_Hash_Status_E Crypto_Hash_Blake_Digest(
crypto_HandlerType_E blakeHandlerType_en,
crypto_Hash_Algo_E blakeAlgorithm_en,
uint8_t *ptr_data,
uint32_t dataLen,
uint8_t *ptr_blakeKey,
uint32_t keySize,
uint8_t *ptr_digest,
uint32_t digestLen,
uint32_t blakeSessionId
);
Description
This API performs hash generation for different variants of BLAKE algorithms in a single step without initializing.
Parameters
No. | Argument Type | Argument Name | Type | Description |
---|---|---|---|---|
1 | crypto_HandlerType_E | blakeHandlerType_en | Input | Enum for crypto operation handler i.e., SW, HW |
2 | crypto_Hash_Algo_E | blakeAlgorithm_en | Input | Selection of BLAKE algorithm variant |
3 | uint8_t* | ptr_data | Input | Input data which digest needs to calculate |
4 | uint32_t | dataLen | Input | Length of the input data in number of bytes |
5 | uint8_t* | ptr_blakeKey | Input | (Optional) Key needed for the BLAKE algorithm Else NULL |
6 | uint32_t | keySize | Input | (Optional) Key size in bytes; up to 64 bytes of BLAKE operation else 0 |
7 | uint8_t* | ptr_digest | Output | Pointer to store calculated digest |
8 | uint32_t | digestLen | Input | Digest length can be 1 to 32 bytes for BLAKE2S and Digest size for BLAKE2B can be 1 to 64 bytes |
9 | uint32_t | blakeSessionId | Input | It defines the session ID, must be more than zero |
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;
uint8_t inputData[32] = {/*data*/};
uint32_t dataLen = 33; // any length from 1 to 32 bytes for BLAKE2S and Digest size for BLAKE2B can be 1 to 64 bytes
uint8_t digest[64];
uint32_t digestLen = sizeof(outData);
uint8_t key[64] = {/*data*/};
uint32_t keyLen = sizeof(key);
status = Crypto_Hash_Blake_Digest(
handlerType_en,
blakeAlgorithm_en,
inputData,
dataLen,
key,
keyLen,
digest,
digestLen,
sessionID
);