|
QuickHash Library |
C++ Interface |
|
CAdler32::Calculate
static void Calculate( unsigned char*
pDest, const unsigned char* pSrc, unsigned int
nSrcLength );
static void Calculate( unsigned char*
pDest, const char* pSrc );
Parameters
pDest
[out] Pointer to the memory
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.
Remarks
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 in the memory buffer pointed by
pDest. The size of the memory buffer pointed by pDest must be at
least CAdler32::DIGESTSIZE bytes.
Example
#include <string.h>
#include <QuickHash.h>
using namespace QuickHash;
int main()
{
char mydata[] = "Test String";
unsigned char checksum[ CAdler32::DIGESTSIZE ];
//Calculate and retrieve the checksum
CAdler32::Calculate( checksum, (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
CAdler32::Calculate(
checksum, (const unsigned char*)mydata, strlen(
mydata ) );
can be replaced by
CAdler32::Calculate(
checksum, mydata );
CAdler32 Overview
| Class Members
|
Useful Links | HashCalc
See Also CAdler32::CalculateHex
|