C
C
Example: Crypt2.CrcBd method
Demonstrates how to call the CrcBd method.Chilkat C Downloads
#include <C_CkCrypt2.h>
#include <C_CkBinData.h>
void ChilkatSample(void)
{
HCkCrypt2 crypt;
HCkBinData bd;
unsigned long crc32;
unsigned long crc8;
crypt = CkCrypt2_Create();
bd = CkBinData_Create();
CkBinData_AppendString(bd,"123456789","us-ascii");
crc32 = CkCrypt2_CrcBd(crypt,"crc-32",bd);
// The decimal value is 3421780262 (converted to hex is 0xCBF43926)
printf("%u\n",crc32);
crc8 = CkCrypt2_CrcBd(crypt,"crc8",bd);
printf("%u\n",crc8);
CkCrypt2_Dispose(crypt);
CkBinData_Dispose(bd);
}