| QuickHash Library | C++ Interface |
|
CHMAC::CalculateHex
static void CalculateHex( char* pDest, const unsigned char* pSrc, unsigned int nSrcLength, const unsigned char* pKey, unsigned int nKeyLength = DEFAULTKEYLEN, bool bUpper = false );
static void CalculateHex( char* pDest, const char* pSrc, const char* pKey, bool bUpper = false );
Parameters
pDest
[out] Pointer to the text buffer that will receive the HMAC.
pSrc
[in]
In the first case - pointer to the continuous memory block for which to calculate the HMAC.
In the second case - pointer to the null-terminated string for which to calculate the HMAC.
nSrcLength
[in] Length in bytes of the memory block.
pKey
[in]
In the first case - pointer to the continuous memory block used as the key.
In the second case - pointer to the null-terminated string used as the key.
nKeyLength
[in] Length in bytes of the key.
bUpper
[in] Uppercase flag. If bUpper is false, the received HMAC represents a lowercase string, otherwise it represents an uppercase string.
Remarks
static void CalculateHex( char* pDest, const unsigned char* pSrc, unsigned int nSrcLength, const unsigned char* pKey, unsigned int nKeyLength = DEFAULTKEYLEN, bool bUpper = false );
Calculates the HMAC for the memory block pointed by pSrc using the key which is a memory block pointed by pKey.
static void CalculateHex( char* pDest, const char* pSrc, const char* pKey, bool bUpper = false );
Calculates the HMAC for the null-terminated string pointed by pSrc using the key which is a null-terminated string 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 CHMAC<T>::HEXDIGESTSIZE characters. For example, the size of the text buffer pointed by pDest must be at least CHMAC<CMD5>::HEXDIGESTSIZE characters, if the HMAC is calculated using the MD5 hash algorithm.
Example
|
Note.
In the above example mydata and key are null-terminated strings. Therefore, the call
CHMAC<CMD5>::CalculateHex( hmachex, (const unsigned char*)mydata, strlen(
mydata ), (const unsigned char*)key, strlen( key ) );
can be replaced by
CHMAC<CMD5>::CalculateHex( hmachex,
mydata, key );
CHMAC Overview | Class Members | Useful Links | HashCalc
See Also CHMAC::Calculate
| Send Feedback to SlavaSoft Inc. | Tell a friend about QuickHash Library |