Original link http://blog.chinaunix.net/uid-26435987-id-3164528.html
CRC (full name cyclical redundancy check), cyclic redundancy code check
Calibration principle:1. Cyclic check code (CRC code):Is the most commonly used error check code in the field of data communication, which is characterized byInformation FieldsAndCheck FieldCan be selected at any length. 2, the basic principle of generating CRC code:Any one bybits StringThe code of the composition can correspond to a polynomial one by one with a coefficient of only ' 0 ' and ' 1 '. For example: Code 1010111 corresponds to a polynomial of x6+x4+x2+x+1, while the polynomial is x5+x3+x2+x+1 corresponding to the code 101111. 3. CRC code Set Selection principle:If the code word length is N, the information field is K bit, the check field is R bit (n=k+r), then for any code word in the CRC code set, there is only one R polynomial g (x), so that V (x) =a (x) g (x) =xrm (x) +r (x); Where: M (x) is K-th information polynomial, R (x) is a R-1-check polynomial, g (x) is called the Generation polynomial: g (x) =g0+g1x+ g2x2+...+g (R-1) x (R-1) +GRXRThe sender uses the specified g (x) to generate the CRC code word, and the receiver verifies the received CRC by the G (X). 4, CRC check Code software generation method:With the help of polynomial division, the remainder is a check field. For example: The Information field code is: 1011001; the corresponding k=6 polynomial m (x) =x6+x4+x3+1 assumes that the resulting polynomial is: g (x) =x4+x3+1; then the code for G (x) is: 11001 x4m (x) =x10+x8+x7+x4 corresponds Code for: 10110010000; polynomial division (note): The remainder is: 1010 (that is, the Check field is: 1010)Sending Party: Transmit field emitted: 1 0 1 1 0 0 1 1 0 1 0 Information field Check fieldReceiving Party: Use the same build code for validation: The Received field/generate code (modulo 2 division) is correct if it can be removed. "Modulo 2 In addition to" the demo Picture: http://baike.baidu.com/view/3385584.htm Explanation modulo 2 division
"Go" CRC check