Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CRC divisor calculation

Tags:

algorithm

crc

Im trying to understand CRC and I'm getting confused as how to calculate the 'divisor'.

In the example on wikipedia the divisor is 11 (1011) for input of 11010011101100

11010011101100 000 <--- input left shifted by 3 bits
1011               <--- divisor (4 bits) = x³+x+1
------------------
01100011101100 000 <--- result

How is the divisor calculated? In this example (x³+x+1) x is 2? Where did the 2 come from?

like image 559
tMC Avatar asked Sep 01 '11 14:09

tMC


2 Answers

From the "Mathematics of CRC" section of that same wikipedia it starts "Mathematical analysis of this division-like process reveals how to pick a divisor that guarantees good error-detection properties." This is the key to it. Some divisors are better than others so you just find a standard one and use that usually.

The bottom of that page describes some of the different CRCs used and the polynomial that defines their divisors.

like image 170
Chris Avatar answered Sep 30 '22 12:09

Chris


It's written in the next sentence @wikipedia:

If the input bit above the leftmost divisor bit is 0, do nothing. If the input bit above the leftmost divisor bit is 1, the divisor is XORed into the input.

Which means:

1101 xor 1011 => 0110
like image 33
duedl0r Avatar answered Sep 30 '22 11:09

duedl0r