jgaeddert / liquid-dsp

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

wrong CRC16 results #370

Open dl3yc opened 4 months ago

dl3yc commented 4 months 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.