For my archive:
I happened to notice that the Arduino OneWire library uses a 256 entry lookup table for its CRC calculations.
I did some research on this topic in 1992-1993, while working on Bulletin Board Systems, FidoNet code and file transfer protocols.
These days memory is not at a premium on most computers, however on Arduino and microcontroller environments it definitely is, and I happen to know that table-lookup CRC can be done using two 16-entry tables!
So I’ve dug up my documentation and code from the time, and applied it to the CRC-8 calculation for the Maxim (Dallas Semiconductor) OneWire bus protocol.
I think this provides a neat trade-off between code size and speed.
License For any of the below code, apply the following license (2-clause “simplified” BSD license), which should suffice for any use. If you do require another license, just ask.
Source: [WayBack/Archive.is] Calculating CRC with a tiny (32 entry) lookup-table | Lentz family blog
The example on the page is for the CRC-8 implementation used in the [WayBack] 1-Wire Communication protocol – Wikipedia.
The generator works for CRC-8, CRC-16 and CRC-32 polynomials and can be downloaded here:
–jeroen
Like this:
Like Loading...