Implementation of CRC16-CCITT using polynomial 0x1021 = x^16 + x^12 + x^5 + 1
Embed:
(wiki syntax)
Show/hide line numbers
CRC16_CCITT.h
00001 /* 00002 * This is a fork of the CRC16 library COPYRIGHT(c) Emilie Laverge 00003 * published at [https://developer.mbed.org/users/EmLa/code/CRC16/] 00004 * 00005 * Modified by Zoltan Hudak to implement CRC16-CCITT 00006 * using the polynomial 0x1021: X^16 + X^15 + X^2 + 1. 00007 * Default initial CRC value = 0x0000 00008 */ 00009 00010 #ifndef CRC16_CCITT_H 00011 #define CRC16_CCITT_H 00012 00013 class CRC16_CCITT 00014 { 00015 private: 00016 static const unsigned int SHIFTER; 00017 static const unsigned short TABLE[]; 00018 public: 00019 CRC16_CCITT(void){}; 00020 ~CRC16_CCITT(void){}; 00021 unsigned short calc(char input[], int length, unsigned short crc = 0x0000); 00022 }; 00023 00024 #endif // CRC16_CCITT_H
Generated on Thu Jul 21 2022 11:51:16 by 1.7.2