CRC code cyclic redundancy check code

Source: Internet
Author: User

The process of checking errors using CRC can be simply described as follows: the sender follows certain rules based on the K-bit binary code sequence to be transmittedGenerates an R-bit supervision code (CRC Code) for verification, which is attached to the original information.To form a new binary code sequence consisting of K + R bits and then sent out. At the receiving end, check the rules observed between the Information Code and CRC code to determine whether an error occurs during transmission. This rule is called "generate polynomial" in error control theory ".

CRCCode Generation steps

1. Convert the generated polynomial g (x) with the highest power of X to the corresponding R + 1 binary number.

2. Shift the Information Code left to the r bit, equivalent to the r power of the corresponding information polynomial C (x) * 2

3. Divide the Information Code by generating a polynomial (Binary Number) to obtain the remainder of the r bit.

4. Place the remainder to the left of the Information Code and then empty the result to obtain the complete CRC code. [Example] assume that the generated polynomial is g (x) = X3 + x + 1. The 4-bit original packet is 1010, And the encoded packet is obtained. (G (x) is the convention between the receiver and the sender) solution: 1. Convert the generated polynomial g (x) = X3 + x + 1 into the corresponding binary divisor of 1011. 2. The generated polynomial contains four bits (R + 1). The original packet C (x) needs to be shifted to 3 (r) bitwise to 1010000 3. Use the binary number corresponding to the generated polynomial to divide the original packet after four shifts to the left: there are two methods of division here. One is to convert the original binary into a decimal system, and then perform Division operations to obtain the remainder. Convert the remainder to binary, that is, to enter the binary number following this example 1010000 (after the original packet is shifted) into a decimal value of 80 1011 (generating polynomial) convert to decimal to 11 11 except 80, and convert the remainder to 3 to binary 011. This 011 is the packet (CRC) to be encoded in the last three digits of the Verification Code ): 1010000 + 011 ------------------ 1010011 [Example] Information Field Code 1011001; corresponding M (x) = X6 + X4 + X3 + 1

Assume that the generated polynomial is: g (x) = X4 + X3 + 1; then the code corresponding to G (x) is 11001x4 m (X) = The code corresponding to x10 + X8 + X7 + X4 is recorded as: 10110010000; the remainder of the result obtained using polynomial division is: 1010 (that is, the verification field is: 1010). Sender: The transmitted field is: 1 0 1 1 0 0 1 1010 information field verification field receiver: use the same generation code for verification: The received field/Generation Code (Binary Division) if it can be exhausted, it is correct, the formula for calculating the remainder (1010) is as follows: Division does not have a mathematical meaning, but instead it uses a computer's modulo division, That is, the divisor and the divisor perform an exclusive or operation. When the XOR operation is performed, the highest bit of the divisor is aligned with that of the divisor. (Obtain the remainder) 10110010000 ^ 11001 --------------------------- 01111010000 1111010000 ^ 11001 ----------------------------- 0011110000 11110000 ^ 11001 -------------------------- 00111000 111000 ^ 11001 ----------------- 001010 then the four-digit CRC supervision code is 1010. Check is to use the Information Code divided by the generated code to check whether the remainder is the verification code.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.