CRC doesn't return expected value
Your input data is wrong. The first one should be b'\x01\x04\x00\x0b\x00\x01'
for example. The first string as written by you has '\0'
(a null character), followed by the literal characters 'x04'
, and so on. You can check this by printing the strings.
Once this is corrected your code appears to give the correct results.
As a minor note, your type information for the data
parameter says it takes a bytearray
but you're actually passing it bytes
.