CS485 Sylabus

### Designing good CRC generating polynmials

• Designing CRC good polynomials

• There is a rich Mathematical theory on how to design CRC polynomials with certain desirable properties

• It's beyond the scope of this Networking course to go into the Mathematical details.

• I will only show you 2 results

 How to design a generator polynomial that can detect an even number of bit errors How to design a generator polynomial that can detect n consecutive bits in error

• Preliminary: polynomial factoring and primitive polynomial

• Factors of a polynomial

• When a polynomial can be obtained by multiplying 2 polynomials:

 ``` polynomial = polynomial1 × polynomial2 ```

we say that:

 The polynomial can be factored Polynomials polynomial1 and polynomial2 are the factors of the polynomial polynomial

Example:

 ``` (x2 + x + 1) × (x + 1) = (x3 + x2 + x) + (x2 + x + 1) = x3 + 2x2 + 2x + 1 = x3 + 1 (mod 2) Therefore: x2 + x + 1 and x + 1 are factors of x3 + 1 because: x3 + 1 = (x2 + x + 1) × (x + 1) ```

• Primitive polynomial:

• Primitive polynomial = a polynomial that cannot be factored

I.e., A primitive polynomial cannot be written as a product of 2 different polynomials:

 ``` polynomial1 × polynomial2 ```

• Generator polynomial that can detect all odd number of bit errors

• Parity Property:

• A generator polynomial that contains the factor x+1 (= 11) can detect all errors that affect an odd number of bits

 This property is called the Parity property

Example:

 ``` Generator polynomial: 1001 has the factor 11 How to check if gen. polyn. contains the factor "x+1" (= 11): Divide by 11: 111 -------- 11 / 1001 11 --- 10 11 --- 11 11 --- 0 <---- That means: 1001 = 11 × 111 in other words: 1001 contains the factor "x+1" ```

• Property of polynomials that contains "x+1" (= 11) as a factor

• Property of polynomial with (x+1) as a factor:

• Every message that is CRC protected by a polynomial with (x+1) as a factor has this property:

 The number of 1 bits in the CRC protected message has an even number of 1 bits

• Example:

 ``` Message: 10011 (has an odd # 1 bits) CRC polynomial: 1001 (1001 has 11 as factor) Compute CRC code: ------------- 1001 / 10011000 1001 ---- 01000 1001 ----- 001 <---- Remainder CRC protected message: 10011001 (has an even number 1 bits !!!) ```

• Why a polynomial containing "x+1" (= 11) can detect an even number of bit errors

• Why a polynomial containing "x+1" (= 11) can detect an odd number of bit errors:

• An odd number of bit errors will result in a received message containing an odd number of 1 bits

Reason:

• The CRC protected message has an even number of 1 bits (see previous claim)

• There are 2 possible bit errors

 ``` Bit error type | Effect -------------------------------+------------------------- 0 bit sent --> 1 bit received | # 1 bits increased by 1 1 bit sent --> 0 bit received | # 1 bits decreased by 1 ```

• Therefore:

 If there are 0 bit errors: the received message has an even number of 1 bits If there is 1 bit error: the received message has an odd number of 1 bits If there are 2 bit errors: the received message has an even number of 1 bits If there are 3 bit errors: the received message has an odd number of 1 bits And so on ....

• Fact:

• When a received message containing an odd number of 1 bits is divided by the genertor polynomial:

 The remainder of the division will not be equal to 000...000 !!!

This makes sense, because:

• A correctly received CRC protected message will always contain an even number of 1 bits !!

Therefore:

 A received message with an odd number of 1 bits can never be assumed correct !!!

• Generator polynomial that can detect k consecutive bit errors

• Property of a primitive polynomial of degree n:

• If xn + .... + 1 is a primitive polynomial of degree n, then:

 The CRC code can detect any n or less consecutive bit errors

• Reason:

 ``` Error polynomial representing k-consecutive errors: 1111..1 <-----> k bits Generator polynomial = 1.........1 <---------> n+1 bits The division: ----------- 1.........1 / 1111..1 <---------> <-----> n+1 bits k bits will have a non-zero remainder if: k ≤ n ```

• Therefore:

 A generator polynomial containing an primitive polynomial of degree n can detect k consecutive bit errors ---- for any k ≤ n).

• Commonly used (international standard) generator polynomials

• Some commonly used CRC generator polynomials:

Name Generator polynomial
CRC-CCITT 10001000000100001
CRC-16 11000000000000101
CRC-32 100000100110000010001110110110111