I am sending multiple messages from a MCU to my computer and I want to use a 32-bit Cyclic Redundancy Check to verify that the messages are correct. From what I've read, it should be possible to append the last CRC reminder to the last message and run that through the CRC function. If the message was error free, it should then return zero. I have however been unsuccessful in implementing this using the binascii-library [binascii.crc32()].
Let's for example say I want to check the message internally from the example given in python docs (I'm using P 3.5). How would I go ahead checking if this was the correct message?
- Code: Select all
crc = binascii.crc32(b"hello")
crc = binascii.crc32(b" world", crc)