After downloading the library, your first step is to include the header:
After that, you will get access to the following function:
/* Computes CRC-32C (Castagnoli) checksum. Uses Intel's CRC32 instruction if it is available. Otherwise it uses a very fast software fallback. */ extern "C" uint32_t crc32c_append( uint32_t crc, // Initial CRC value. Typically it's 0. // You can supply non-trivial initial // value here. Initial value can be used // to chain CRC from multiple buffers. const uint8_t *input, // Data to be put through the CRC // algorithm. size_t length); // Length of the data in the input // buffer.
You can call the function like this:
uint32_t crc = crc32c_append(0, input, 10000);
As the comments in above declaration suggest, you can compute crc from multiple chained buffers:
uint32_t intermediate = crc32c_append(0, input, 3000); uint32_t crc = crc32c_append(intermediate, input + 3000, 7000);
And that's it. You can add any pre/post-processing of the CRC value if your application requires it. Enjoy!