Author Topic: PSA: How to specify CRC for minimized pain  (Read 458 times)

0 Members and 1 Guest are viewing this topic.

Online SiwastajaTopic starter

  • Super Contributor
  • ***
  • Posts: 9333
  • Country: fi
PSA: How to specify CRC for minimized pain
« on: July 20, 2022, 11:18:48 am »
Happens every single time. Give me product X to communicate with. After day or two of work, everything works; configuration, parsing, etc. Except I can't leave that CRC unchecked, really. So time to implement the small, trivial last thing, the CRC checking. Except this will invariably take one full day of work, including me googling how CRCs worked after all, writing brute-force reverse-engineering solvers, all this regardless how many CRC implementations I have seen, used or written. This is significant part of the whole project!

So please, when you design a product and are writing the datasheet, regardless of how much pressure you get from above to keep the text "concise" by hiding relevant information, do for the sake of (deity) include all this information:

1) Polynomial
2) In which form the polynomial is
3) Initial value
4) Is input reflected
5) Is output reflected
6) xorout value
7) Reference calculation i.e., one arbitrary input data (in hexadecimal) and the calculated CRC thereof
8) Endianness of the result
9) If any weird oddities like extra padding is involved, first remove such special snowflake stuff, and if unable, specify them completely
10) Copy and paste C code which calculates the checksum. You have it already implemented anyway. Other languages may be acceptable. 1000 LoC of C++ which finally constructs boost CRC library is not.
11) If said code is longer than 10 lines of code, or if it references any library, you are doing something wrong, retry until succeeded.

Thank you in advance for not making bullshit products.

And if at all possible, pick some really popular CRC. Copy-paste the full name and full description from https://reveng.sourceforge.io/crc-catalogue/all.htm . Don't be the prick who uses CRC-16/CCITT-FALSE and calls it CRC-16/CCITT.
« Last Edit: July 20, 2022, 11:21:07 am by Siwastaja »
 
The following users thanked this post: tom66, MarkL, Nominal Animal, niconiconi


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf