|
QuickHash Library |
C++ Interface |
|
CCRC16::CalculateHex
static void CalculateHex( char* pDest,
const unsigned char* pSrc, unsigned int nSrcLength,
bool bUpper = false );
static void CalculateHex( char* pDest,
const char* pSrc, bool bUpper = false );
Parameters
pDest
[out] Pointer to the text
buffer that will receive the checksum.
pSrc
[in]
In the first case - pointer to the
continuous memory block for which to calculate the checksum.
In the second case - pointer to the
null-terminated string for which to calculate the checksum.
nSrcLength
[in] Length in bytes
of the memory block.
bUpper
[in] Uppercase flag.
If
bUpper is false, the received checksum represents a lowercase string,
otherwise it represents an uppercase string.
Remarks
-
static void CalculateHex( char* pDest,
const unsigned char* pSrc, unsigned int nSrcLength,
bool bUpper = false );
Calculates the checksum for the memory block
pointed by pSrc.
Calculates the checksum for the
null-terminated string pointed by pSrc.
The checksum 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 CCRC16::HEXDIGESTSIZE characters.
Example
#include <string.h>
#include <QuickHash.h>
using namespace QuickHash;
int main()
{
char mydata[] = "Test String";
char checksumhex[ CCRC16::HEXDIGESTSIZE ]; //0 terminated
//Calculate and retrieve the checksum in hex format
CCRC16::CalculateHex( checksumhex, (const unsigned char*)mydata, strlen( mydata ) );
//Use the checksum
//...
return 0;
}
|
|
Note.
In the above example mydata is
a null-terminated string. Therefore, the call
CCRC16::CalculateHex( checksumhex, (const unsigned char*)mydata, strlen(
mydata ) );
can be replaced by
CCRC16::CalculateHex( checksumhex,
mydata );
CCRC16 Overview
| Class Members
|
Useful Links | HashCalc
See Also CCRC16::Calculate
|