Closed schlatterbeck closed 5 years ago
Hi Ralf, this patch breaks the regression tests, I have to turn the request down for now. I'm not rejecting it outright, but a pull request would have to pass the tests (or fix them if they have a bug). I'm still thinking about your comments in #32; I think I need to go over the algorithm in detail before reaching a conclusion.
$ python test/test.py -av
[...]
/tmp/pycrc.9YWuJu/crc_tbl_idx2 --width 8 --poly 0x5 --reflect-in 0 --reflect-out 1 --xor-in 0x0 --xor-out 0x0
/tmp/pycrc.9YWuJu/crc_tbl_idx4 --width 8 --poly 0x5 --reflect-in 0 --reflect-out 1 --xor-in 0x0 --xor-out 0x0
python pycrc.py --width 8 --poly 0x5 --reflect-in 0 --reflect-out 1 --xor-in 0x1 --xor-out 0x0
/tmp/pycrc.9YWuJu/crc_bbb_c89 --width 8 --poly 0x5 --reflect-in 0 --reflect-out 1 --xor-in 0x1 --xor-out 0x0
error: different checksums!
/tmp/pycrc.9YWuJu/crc_bbb_c89 --width 8 --poly 0x5 --reflect-in 0 --reflect-out 1 --xor-in 0x1 --xor-out 0x0: expected 0x91, got 0x8a
Error was in the file handling not in check-string
The xor-in value must be reflected whenever the reflect-out parameter is set not the reflect-in: reflect-in only applies to individual bytes in the input, reflect-out applies to the reflection of the register. The reflection of xor-in was missing for strings (and hex-strings) and was wrongly applied when reflect-in was set (not reflect-out) for files.