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

error: different checksums! #13

Open iainrist opened 8 years ago

iainrist commented 8 years ago

Due to hardware constraints, attempting to generate an 8-bit CRC using a 16-bit CRC. pycrc gives different answers for its separate algorithms.

> python --version
Python 2.7.10
>python pycrc.py --width=8 --poly=0x105 --reflect-in=False --xor-in=0xfe --reflect-out=False --xor-out=0x00
0x91
> python pycrc.py --width=16 --poly=0x10500 --reflect-in=False --xor-in=0xfe00 --reflect-out=False --xor-out=0x00
pycrc.py: error: different checksums!
       bit-by-bit:        0x100
       bit-by-bit-fast:   0x9100
       table_driven:      0x9100
tpircher-zz commented 8 years ago

This can happen if a poly is even. Not all even polynomials are well-defined. I'm not sure if this is possible to fix in general, I'd need to go back to paper and pencil. I'll mark this for a "future" milestone.