

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


Take a binary message and convert it to a polynomial then divide it by another predefined polynomial called the key. The remainder from this division is the CRC. Now transmit both the message and the CRC. The recipient of the transmission does the same operation (divides the message by the same key) and compares his CRC with yours. If they differ, the message must have been mangled. If, on the other hand, they are equal, the odds are pretty good that the message went through uncorrupted. Most localized corruptions (burst of errors) will be caught using this scheme. Not all keys are equally good. The longer the key, the better error checking. On the other hand, the calculations with long keys can get pretty involved. Ethernet packets use a 32 โbit CRC corresponding to degreeโ 31 remainder (remember, you need d + 1 coefficients for a degreeโd polynomial). Since the degree of the remainder is always less than the degree of the divisor, the Ethernet key must be a polynomial of degree 32. A polynomial of degree 32 has 33 coefficients requiring a 33 โbit number to store it. However, since we know that the highest coefficient (in front of x^32 ) is 1, we don't have to store it. The key used by the Ethernet is 0x04c11db7. It corresponds to the polynomial: **x 32
Let's do a simple example, dividing a message 100110 by the key 101. Remember that the corresponding polynomials are x^5 + x 2 + x and x^2 + 1. Since the degree of the key is 2, we start by appending two zeros to our message. 100110 00 / 101 101 111 101 100 101 100 101 01 We don't even bother calculating the quotient, all we need is the remainder (the CRC), which is 01 in this case. The original message with the CRC attached reads 10011001. You can easily convince it that it is divisible by the key, 101, with no remainder.
The mechanics of computing an nโbit binary CRC are simple. The bits representing the input are lined up in a row, and the (n+1)โbit pattern representing the CRC's divisor (called a "polynomial" because of the tools used in the mathematical analysis of CRCs) is positioned underneath the leftโhand end of the row. Here is the starting position for computing a 3 โbit CRC: 11010011101100 <โโโ input 1011 <โโโ divisor (4 bits) If the input bit above the leftmost divisor bit is 1, the divisor is exclusiveโORed into the input (in other words, the input bit above each 1 โbit in the divisor is toggled). The divisor is then shifted one bit to the right, and the process is repeated until the divisor reaches the rightโhand end of the input row: 00000000000101 <โโโ remainder (3 bits) 1011 <โโโ divisor Since the leftmost divisor bit zeroed every input bit it touched, when this process ends the only bits in the input row that can be nonzero are the n bits at the rightโhand end of the row. These n bits are the remainder of the division step, and will also be the value of the CRC function (unless the CRC specification calls for some post processing). CRC8 Polynomial: X^8 + X^4 + X^3 + X^2 +