0xE2CB is a left shifting answer
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
typedef unsigned char uint8_t;
typedef unsigned short uint16_t;
int main(int argc, char **argv)
{
int i, j, k;
uint16_t crc;
uint8_t test[] = { 0x23,0x41,0x54,0x4F,0x4E,0xFF,0x53,0x4C,0x30,0x43,0x55,0x52,0xFF,0x0A,0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39 };
#define POLY 0x8005
crc = 0x0000;
for(j=0; j<sizeof(test); j++)
{
crc = crc ^ (test[j] << 8);
for(i=0; i<8; i++)
{
if (crc & 0x8000)
crc = (crc << 1) ^ POLY;
else
crc = (crc << 1);
}
}
printf("crc=%04X\n", crc);
return(1);
}
0x43BD is the right shifting answer with the 0xA001 poly (ie 0x8005 reversed)
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
typedef unsigned char uint8_t;
typedef unsigned short uint16_t;
int main(int argc, char **argv)
{
int i, j, k;
uint16_t crc;
uint8_t test[] = { 0x23,0x41,0x54,0x4F,0x4E,0xFF,0x53,0x4C,0x30,0x43,0x55,0x52,0xFF,0x0A,0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39 };
#define POLY 0xA001
crc = 0x0000;
for(j=0; j<sizeof(test); j++)
{
crc = crc ^ test[j];
for(i=0; i<8; i++)
{
if (crc & 0x0001)
crc = (crc >> 1) ^ POLY;
else
crc = (crc >> 1);
}
}
printf("crc=%04X\n", crc); // 0x43BD
return(1);
}