QuickHash Library C++ Interface

CMD5::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 message digest.

 pSrc

    [in]

    In the first case - pointer to the continuous memory block for which to calculate the message digest.

    In the second case - pointer to the null-terminated string for which to calculate the message digest.

 nSrcLength

    [in] Length in bytes of the memory block. 

Remarks

Calculates the message digest for the memory block pointed by pSrc.

Calculates the message digest for the null-terminated string pointed by pSrc.

The digest is retrieved in the memory buffer pointed by pDest. The size of the memory buffer pointed by pDest must be at least CMD5::DIGESTSIZE bytes.

Example

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

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

    //Calculate and retrieve the digest

    CMD5::Calculate( digest, (const unsigned char*)mydata, strlen( mydata ) );

    //Use the digest
    //...
    return 0;
}

 

 

Note.

In the above example mydata is a null-terminated string. Therefore, the call

    CMD5::Calculate( digest, (const unsigned char*)mydata, strlen( mydata ) );

can be replaced by

    CMD5::Calculate( digest, mydata );

 

CMD5 Overview   |   Class Members   |   Useful Links   |   HashCalc

 

See Also    CMD5::CalculateHex


 

 

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