问题
Background
I need to implement a CRC16 with a custom polynomial in Javascript.
Research
After searching several NPM modules and this SO question ( as well as all the links the comments suggest ):
- Javascript CRC16 sample code or implementation
- https://github.com/donvercety/node-crc16
I am still not any closer to my goal.
Problem
My problem is that even though I have the code, I can't understand how to re-use a given CRC16 solution because I don't know where to find the polynomial definition in the code. With all the shifts and whatnot it's just too cryptic for me.
Question
How can I have a CRC16 function with a custom polynomial ?
回答1:
The example linked has a table derived from the CRC polynomial. You can certainly find code that generates the table, given the polynomial. You can find code that computes any CRC, and code that generates CRC code, including the table, given the definition of the CRC (polynomial, bit-ordering, initial value, final xor value).
来源:https://stackoverflow.com/questions/50026573/how-do-i-implement-a-crc16-with-a-custom-polynomial-in-javascript