I'm trying to understand how crc is calculated of below data packets of unbranded air con remote controller. it's last 4 bits seem to be crc and data packet is 8 bytes long. I can understand how to extract the data packet but not crc. First 3 bits are fixed.
data pattern eg 1) 0010 0100 0100 0011 0000 0000 0000 0000 0000 0000 1110
data pattern eg 2) 0010 1000 0101 0011 0000 0000 0000 0000 0000 0000 1101
data pattern eg 3) 0010 1000 0110 0011 0000 0000 0000 0000 0000 0000 1100
data pattern eg 4) 0010 1000 0111 0011 0000 0000 0000 0000 0000 0000 1011
data pattern eg 5) 0010 1000 1000 0011 0000 0000 0000 0000 0000 0000 1010
data pattern eg 6) 0010 1000 1001 0011 0000 0000 0000 0000 0000 0000 1001
data pattern eg 7) 0010 1000 1010 0011 0000 0000 0000 0000 0000 0000 1000
data pattern eg 8) 0010 1000 1011 0011 0000 0000 0000 0000 0000 0000 0111
data pattern eg 9) 0010 1000 0000 0011 0000 0000 0000 0000 0000 0000 0010
data pattern eg 10) 0010 1000 0001 0011 0000 0000 0000 0000 0000 0000 0001
data pattern eg 11) 0010 1000 0010 0011 0000 0000 0000 0000 0000 0000 0000
data pattern eg 12) 0010 1000 0011 0011 0000 0000 0000 0000 0000 0000 1111
I think this might be just an inverted sum.
Adding up all but last 4 bits, and then ((x&1111)^1111)
:
0010 + 0100 + 0100 + 0011 = 1101 -> 0010*
0010 + 1000 + 0101 + 0011 = 10010 -> 1101
0010 + 1000 + 0110 + 0011 = 10011 -> 1100
0010 + 1000 + 0111 + 0011 = 10100 -> 1011
0010 + 1000 + 1000 + 0011 = 10101 -> 1010
0010 + 1000 + 1001 + 0011 = 10110 -> 1001
0010 + 1000 + 1010 + 0011 = 10111 -> 1000
0010 + 1000 + 1011 + 0011 = 11000 -> 0111
0010 + 1000 + 0000 + 0011 = 1101 -> 0010
0010 + 1000 + 0001 + 0011 = 1110 -> 0001
0010 + 1000 + 0010 + 0011 = 1111 -> 0000
0010 + 1000 + 0011 + 0011 = 10000 -> 1111
Note that first sample is incorrect (should be 1110), but the rest match. I'm not sure if that's an error in my algorithm, or error in input data (looking at the photo, I don't see where 0010 0100 appears).
Also note that samples provided are very similar (only bits 8,9,10,11 differ, if we exclude first sample), so there are probably many ways to end up with "a solution".