QuickHash Library C++ Interface

CCRC32::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 CCRC32::DIGESTSIZE bytes.

Example

#include <string.h>
#include <QuickHash.h>
using namespace QuickHash;

int main()
{
    char mydata[] = "Test String";
    unsigned char checksum[ CCRC32::DIGESTSIZE ];

    //Calculate and retrieve the checksum

    CCRC32::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

    CCRC32::Calculate( checksum, (const unsigned char*)mydata, strlen( mydata ) );

can be replaced by

    CCRC32::Calculate( checksum, mydata );

 

CCRC32 Overview   |   Class Members   |   Useful Links   |   HashCalc

 

See Also    CCRC32::CalculateHex


 

 

Send Feedback to SlavaSoft Inc. Tell a friend about QuickHash Library