Parity check, Check sum, Cyclic redundancy check

Communication technology

Release date:2022/9/17         

In Japanese

Parity check, checksum, and CRC (Cyclic Redundancy Check) are all methods of error detection during data transfer.

■Parity Check

A bit (parity bit) is provided to adjust the number of 1s contained in the transmitted data so that it becomes an even number (or an odd number), and it is added to the original data and transmitted. If the number of 1's is not an even number (odd number), the receiving side detects it as a transfer error.

Parity check is a very simple mechanism, but it cannot detect errors of 2 bits or more.

■Check Sum

Divide the original data and calculate the sum. The checksum is obtained through an algorithm to its summation value. Algorithms include a method of simply using the value of the lower digits as the checksum, and a method of using the remainder after dividing by 255 (0xFF) as the checksum value. If the receiving side also calculates with the same algorithm and the answer does not match, it is detected as a checksum error.

The checksum can detect errors with higher accuracy than the parity check, but continuous errors due to noise (this is called a burst error) occur, and errors such as values being replaced cannot be detected.

<Checksum application example>
Checksum errors are used not only to detect data transfer errors, but also to detect program writing errors and falsification of program sources and specifications. Since the specifications include Japanese, English letters, spaces, etc., when converting it to hexadecimal (or binary), it is converted according to the ASCII code table.

However, if you know the checksum calculation algorithm and the hexadecimal conversion table, it is possible to maliciously tamper with the program source, so you need to be aware that this detection method is not perfect either.

■CRC (Cyclic Redundancy Check)

CRC is a method of calculating using an algorithm more complicated than checksum. In this method, the original data is divided by a generator polynomial, and the remainder is added to the original data before transmission. There is also a method of dividing the total sum of data by 255 like a checksum, but it is characterized by dividing by a more complicated formula.

List of related articles

Communication technology