crc // wrong poly for crc_xmodem_type
Hello All, I've discovered that current typedef crc_xmodem_type uses wrong poly. Current release and master branch:
typedef crc_optimal<16, 0x8408, 0, 0, true, true> crc_xmodem_type;
Should be (ref: http://reveng.sourceforge.net/crc-catalogue/16.htm#crc.cat-bits.16)
typedef crc_optimal<16, 0x1021, 0, 0, false, false>
Develop branch already have some changes which address this error (for ex. https://github.com/boostorg/crc/commit/328bf50f666c463901e2179aa2d890916c3b6...), but master and boost release does not. Who currently owns boost::crc and can fix this issue? Thank you. -- Best Regards, Sergei Nikulov
Hi Sergei.
I've discovered that current typedef crc_xmodem_type uses wrong poly.
I'm not an expert in CRCs and I have no idea whether Boost's implementation is wrong, but it's interesting that: bin(0x8408) = reverse(bin(0x1021)) Maybe this isn't a real problem, but simply someone decided to intentionally flip the poly in the CRC implementation, and the computation still leads to correct results? ——— Pavel K.
Hi Pavel,
2017-05-15 19:40 GMT+03:00 Pavel Kretov
Hi Sergei.
I've discovered that current typedef crc_xmodem_type uses wrong poly.
I'm not an expert in CRCs and I have no idea whether Boost's implementation is wrong, but it's interesting that:
bin(0x8408) = reverse(bin(0x1021))
Maybe this isn't a real problem, but simply someone decided to intentionally flip the poly in the CRC implementation, and the computation still leads to correct results?
——— Pavel K.
I believe this is real problem CRC16 calculator from here https://www.lammertbies.nl/comm/info/crc-calculation.html XMODEM for string "123456789" gives 0x31C3 Test case
>>>>>>>> cut here <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< #define CATCH_CONFIG_MAIN // This tells Catch to provide a main() - only do this in one cpp file #include "catch.hpp"
#include
>>>>>>>> cut here <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
First one check fails with ../test/test_3.cpp:136: FAILED: CHECK( xmv == 0x31C3 ) with expansion: 3187 (0xc73) == 12739 (0x31c3) The second one is passed. -- Best Regards, Sergei Nikulov
participants (2)
-
Pavel Kretov
-
Sergei Nikulov