Tuesday, February 22, 2011

Cyclic Redundancy Check

In our daily ethernet communications the Cyclic Redundency Check is the first system that checks wether our data is received correctly. To calculate the CRC, which you append to the data, you need a so called generator/ key. When you repeatedly XOR the generator with the data the remainder is the CRC.
Source
data=1010101010
generator=10111
CRC=Generator – 1 bit = 4 bits long
Calculate CRC
dataCRC
10101010100000
10111
00010010
10111
0010110
10111
000010000
10111
00111
Add the CRC extension to the data.
dataCRC
10101010100111
Send to destination



























Received at destination
data=1010101010
generator=10111
CRC=00111
Check if received data matches it's CRC
dataCRC
10101010100111
10111
00010010
10111
0010110
10111
000010111
10111
00000
The remainder is 0, so the CRC is valid.