: /* crc.h */ #ifndef CRC_H_INCLUDED #define CRC_H_INCLUDED /* * The CRC parameters. Currently configured for CCITT. * Simply modify these to switch to another CRC Standard. */ /* #define POLYNOMIAL 0x8005 #define INITIAL_REMAINDER 0x0000 #define FINAL_XOR_VALUE 0x0000 */ #define POLYNOMIAL 0x1021 #define INITIAL_REMAINDER 0xFFFF #define FINAL_XOR_VALUE 0x0000 /* #define POLYNOMIAL 0x1021 #define POLYNOMIAL 0xA001 #define INITIAL_REMAINDER 0xFFFF #define FINAL_XOR_VALUE 0x0000 */ /* * The width of the CRC calculation and result. * Modify the typedef for an 8 or 32-bit CRC standard. */ typedef unsigned short width_t; #define WIDTH (8 * sizeof(width_t)) #define TOPBIT (1 > (WIDTH - 8)) ^ message[offset]; remainder = crcTable[byte] ^ (remainder template class CRC { public: CRC(); CRC(TYPE polynomial, TYPE init_remainder, TYPE final_xor_value); void build(TYPE polynomial, TYPE init_remainder, TYPE final_xor_value); /** * Compute the CRC checksum of a binary message block. * @para message