This library implements a high-performance computation of the 64-bit cyclic-redundancy check (CRC) of arbitrary input data. This implementation requires only a C99 compiler, but has been tuned for the IBM BG/Q supercomputer, and can take advantage of a compiler's OpenMP support to compute the CRC in parallel on multiple cores.
Computing and storing or transmitting the CRC code of data while it is written to disk or transmitted over the network, and then using it to verify the integrity of the data upon read-in or receipt, is a powerful way to guard against data corruption. While modern disks and networks are highly reliable, the rate of corruption from malfunctioning software, hardware and external physical processes remains significant (especially for large data sets).
This implementation uses the ECMA-182 polynomial with -1 initialization, and computes the bit-reversed CRC.
You can obtain the latest version of the source code directly from the public git repository:
This library provides the following functions for general-purpose use. For most applications, only crc64_omp (and possibly crc64_invert) will be of use:
Calculate the CRC64 of the provided buffer (in serial).
Calculate the CRC64 of the provided buffer, in parallel if possible (using OpenMP).
Calculate the eight 'check bytes' for the provided CRC64. If these bytes are appended to the original buffer with a CRC64 value 'cs', then the new total CRC64 of the buffer with the check bytes appended should be -1. The check bytes are written to the location specified by the 'check_bytes' pointer. This pointer need not be aligned.
Given the CRC64 of the first part of a buffer, and the CRC64 and length of the second part of a buffer, calculate the CRC64 of the complete buffer.