Error detection in data storage using CRC

Namrata
2 min readJun 25, 2024

--

Cyclic Redundancy Check (CRC) is an error-detecting code used to detect accidental changes to raw data. It is widely used in digital networks and storage devices to detect any changes to data that might have occurred during transmission or storage.

Photo by Nong on Unsplash

Here is a brief overview of how CRC works:

  1. Data Representation: The data to be transmitted or stored is treated as a large binary number.
  2. Generator Polynomial: A predetermined binary sequence, known as the generator polynomial, is used. This polynomial is also represented as a binary number. The generator polynomial is a predetermined and agreed-upon value between the sender and the receiver. This ensures that both parties use the same method to calculate the CRC value and verify the integrity of the data.
  3. Division: The data is divided by the generator polynomial using binary division (without carry). This process involves shifting and XOR operations.
  4. Remainder: The remainder from this division process is the CRC value. This remainder is appended to the original data before transmission or storage.
  5. Verification: At the receiving end, the data (including the appended CRC) is divided by the same generator polynomial. If the remainder of this division is zero, it indicates that the data has been received correctly. If the remainder is non-zero, it indicates that an error has occurred during transmission or storage.

Key Points:

  • Error Detection: CRC is primarily used for error detection, not error correction. It can detect common types of errors such as single-bit errors, double-bit errors, and burst errors.
  • Efficiency: CRC is computationally efficient and can be implemented in hardware and software.
  • Common Uses: CRC is commonly used in network protocols (like Ethernet), file formats (like ZIP files), and storage devices (like hard drives and SSDs).

Example:

Suppose we have a data bit sequence 11010011101100 and a generator polynomial 1011.

  1. Append Zeros: Append zeros to the data sequence equal to the length of the generator polynomial minus one. So, the data becomes 11010011101100000.
  2. Binary Division: Perform binary division of the data sequence by the generator polynomial.
  3. Remainder: The remainder after the division is the CRC value.
  4. Transmitted Data: The original data plus the CRC value is transmitted.
  5. Receiver Check: The receiver performs the same division on the received data. If the remainder is zero, the data is considered correct.

Conclusion:

CRC is a robust and efficient method for error detection in digital communication and storage systems. It helps ensure data integrity by detecting errors that may occur during transmission or storage.

--

--

Namrata
Namrata

Written by Namrata

Engineering @Microsoft A software developer writing her daily bits . https://www.linkedin.com/in/namrataagarwal5/

No responses yet