Archived Forum Post

Index of archived forum posts


CRC32 example

Jun 15 '12 at 09:53

Do you have c++ example of doing CRC32 to string and file and then encode the CRC32 result to base64?

I could not find any CR32 example on Chilkat website.


    CkZipCrc crcObj;
    CkByteData db;

db.appendStr("Some data for CRC32...");

uint32_t crc = crcObj.CalculateCrc(db);

CkByteData dbCrc;
    // Note: The "CkByteData::append" method is overloaded, and overloaded methods introduce
    // complications when generating "C" wrappers.  Because of this, the above append method
    // will be changed to "append2" for the 2-argument overload.  When the next official
    // version is released, the above line will need to be changed to "append2".  This will
    // be documented in the release notes.

CkString strBase64;
    printf("base64 crc = %s\n",strBase64.getString());