QuickHash Library C++ Interface


void Final( unsigned char* pDest );



    [out] Pointer to the memory buffer that will receive the checksum.


Call this member function to retrieve the checksum from the CCRC16 object. The checksum is retrieved in the memory buffer pointed by pDest. The size of the memory buffer pointed by pDest must be at least CCRC16::DIGESTSIZE bytes.

After the Final method is performed, the CCRC16 object is initialized for new calculations, as it would be constructed again.


#include <fstream>
#include <QuickHash.h>

using namespace std;
using namespace QuickHash;

const unsigned int BUFF_SIZE = 1024;

int main()
    fstream file( "c:\\test.txt", ios::in | ios::binary );

    if( !file )
        return 1;

    unsigned char buff[ BUFF_SIZE ];
    unsigned char checksum[ CCRC16::DIGESTSIZE ];

    //Instantiate a CCRC16 object

    CCRC16 hash;

    //Calculate the checksum by calling Update for each block of the file

    while( !file.eof() )
        file.read( ( char* )buff, BUFF_SIZE );
        hash.Update( buff, file.gcount() );

    //Do final changes and get the checksum

    hash.Final( checksum );

    //Use the checksum

    return 0;



CCRC16 Overview   |   Class Members   |   Useful Links   |   HashCalc


See Also    CCRC16::FinalHex, CCRC16::Update



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