tpircher-zz / pycrc

Free, easy to use Cyclic Redundancy Check (CRC) calculator and source code generator
https://pycrc.org
MIT License
169 stars 36 forks source link

Add support for residue values #30

Open rawr51919 opened 5 years ago

rawr51919 commented 5 years ago

In http://reveng.sourceforge.net/crc-catalogue/, the CRCs described within utilize a residue value as part of their calculations. In the case of CRC8 (or at least the implementation pycrc uses), it uses a residue value of 0x00, however other CRC algorithms use different residue values. Do you think that residue values can be reasonably implemented into pycrc, @tpircher?

tpircher-zz commented 5 years ago

I think the residue value is a side product of the calculation, not an init value. In what scenario is this value useful? Is there a use case where this value is used in practice?

me21 commented 2 years ago

It is used for CRC verification: when the device runs the message+CRC through the CRC algorithm again, it'll see a final value of residue if there were no transmission errors. https://stackoverflow.com/a/242164/2404492

Since pycrc is used simply for CRC calculation, it is unclear whether the support of residue should be added to pycrc. The way I currently see it implies that the CRC verification is left to the user.