int SL_HASHCALL SL_HMAC_CalculateStr( unsigned int nAlgID, void* pDest, const char* pSrc, const char* pKey );
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_SHA1_ALGID when you need to calculate the HMAC using SHA-1 hash algorithm.
All supported hash algorithms with their corresponding IDs are listed in Table1.
[out] Pointer to the memory buffer that will receive the HMAC.
[in] Pointer to the null-terminated string for which to calculate the HMAC.
[in] Pointer to the key which represents a null-terminated string.
Calculates the HMAC for the null-terminated string pointed by pSrc using the key pointed by pKey. The HMAC is retrieved in the memory buffer pointed by pDest. The size of the memory buffer pointed by pDest must be at least DIGESTSIZE bytes. DIGESTSIZE is a predefined constant that specifies the size of the HMAC for a specific hash algorithm. For example, you have to allocate at least SLC_SHA1_DIGESTSIZE bytes for the memory buffer pointed by pDest if you need to calculate the HMAC using SHA-1 hash algorithm.
All supported hash algorithms with their corresponding DIGESTSIZEs are listed in Table1.
Table1. Supported hash algorithms, their IDs and DIGESTSIZEs.
|Algorithm Name||Algorithm ID||Algorithm DIGESTSIZE|
Note. The call SL_HMAC_CalculateStr( nAlgID, pDest, pSrc, pKey );
is equivalent to the call SL_HMAC_Calculate( nAlgID, pDest, pSrc, strlen( pSrc ), pKey, strlen( pKey ) );
HMAC API Overview | HMAC API_Functions | Useful Links | HashCalc
See Also SL_HMAC_CalculateStrHex, SL_HMAC_Calculate, SL_HMAC_CalculateHex
|Send Feedback to SlavaSoft Inc.||Tell a friend about QuickHash Library|