C
C
Workaround for the deprecated Crypt2.CrcBytes method
Shows how to replace the deprecated CrcBytes method. (Chilkat is moving away from the use of CkByteData.)Chilkat C Downloads
#include <C_CkCrypt2.h>
#include <C_CkByteData.h>
#include <C_CkBinData.h>
void ChilkatSample(void)
{
HCkCrypt2 crypt;
const char *path;
const char *algorithm;
HCkByteData inData;
unsigned long crc;
HCkBinData bdIn;
crypt = CkCrypt2_Create();
path = "c:/someDir/example.dat";
algorithm = "crc-32";
// ------------------------------------------------------------------------
// The CrcBytes method is deprecated:
inData = CkByteData_Create();
CkByteData_loadFile(inData,path);
crc = CkCrypt2_CrcBytes(crypt,algorithm,inData);
// ------------------------------------------------------------------------
// Workaround.
// (Chilkat is moving away from using CkByteData)
bdIn = CkBinData_Create();
CkBinData_LoadFile(bdIn,path);
crc = CkCrypt2_CrcBd(crypt,algorithm,bdIn);
CkCrypt2_Dispose(crypt);
CkByteData_Dispose(inData);
CkBinData_Dispose(bdIn);
}