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 TypeArgument NameTypeDescription
1crypto_HandlerType_EblakeHandlerType_enInputEnum for crypto operation handler i.e., SW, HW
2crypto_Hash_Algo_EblakeAlgorithm_enInputSelection of BLAKE algorithm variant
3uint8_t*ptr_dataInputInput data which digest needs to calculate
4uint32_tdataLenInputLength of the input data in number of bytes
5uint8_t*ptr_blakeKeyInput(Optional) Key needed for the BLAKE algorithm Else NULL
6uint32_tkeySizeInput(Optional) Key size in bytes; up to 64 bytes of BLAKE operation else 0
7uint8_t*ptr_digestOutputPointer to store calculated digest
8uint32_tdigestLenInputDigest length can be 1 to 32 bytes for BLAKE2S and Digest size for BLAKE2B can be 1 to 64 bytes
9uint32_tblakeSessionIdInputIt defines the session ID, must be more than zero

Returns

Return TypeDescription
crypto_Hash_Status_EFunction 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
    );