jgaeddert / liquid-dsp

digital signal processing library for software-defined radios
http://liquidsdr.org
MIT License
1.82k stars 426 forks source link

wrong CRC16 results #370

Open dl3yc opened 4 days ago

dl3yc commented 4 days ago

Hello!

I am trying to calculate a USB compatible CRC16. After some debugging and comparison with online calculators i found an initialization error in your crc16_generate_key function: unsigned int i, j, b, mask, key16=~0;

For 16-bit CRC the initial value(e.g. 0xFFFF) should be 16-bit wide, but with unsigned int it initializes to 0xFFFFFFFF. After correcting the init value the resulting key is correct.