int SL_HASHCALL SL_HMAC_CalculateHex( unsigned int nAlgID, void* pDest, const void* pSrc, unsigned int nSrcLength, const void* pKey, unsigned int nKeyLength, int bUpper );
Nonzero if calculation is successful, otherwise 0. In particular, this function returns 0 when nAlgID is invalid.
[in] The ID of the hash algorithm selected for calculations. For example, nAlgID has to be set to SLC_SHA256_ALGID when you need to calculate the HMAC using SHA256 hash algorithm.
All supported hash algorithms with their corresponding IDs are listed in Table1.
[out] Pointer to the text buffer that will receive the HMAC.
[in] Pointer to the continuous memory block for which to calculate the HMAC.
[in] Length in bytes of the memory block.
[in] Pointer to the key which represents a continuous memory block.
[in] Length in bytes of the key.
[in] Uppercase flag. If bUpper is 0, the received HMAC represents a lowercase string, otherwise it represents an uppercase string.
Calculates the HMAC for the memory block pointed by pSrc using the key pointed by pKey. The HMAC is retrieved as a null-terminated hexadecimal string in the text buffer pointed by pDest. The size of the text buffer pointed by pDest must be at least HEXDIGESTSIZE characters. HEXDIGESTSIZE is a predefined constant that specifies the size of the hexadecimal string representation of the HMAC for a specific hash algorithm. For example, you have to allocate at least SLC_SHA256_HEXDIGESTSIZE characters for the text buffer pointed by pDest if you need to calculate the HMAC using SHA256 hash algorithm.
All supported hash algorithms with their corresponding HEXDIGESTSIZEs are listed in Table1.
Table1. Supported hash algorithms, their IDs and HEXDIGESTSIZEs.
|Algorithm Name||Algorithm ID||Algorithm HEXDIGESTSIZE|
HMAC API Overview | HMAC API Functions | Useful Links | HashCalc
See Also SL_HMAC_Calculate, SL_HMAC_CalculateStr, SL_HMAC_CalculateStrHex
|Send Feedback to SlavaSoft Inc.||Tell a friend about QuickHash Library|