| Source | ||||||||||||||||||||||||||
| data | = | 1 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | |||||||||||||||
| generator | = | 1 | 0 | 1 | 1 | 1 | ||||||||||||||||||||
| CRC | = | Generator – 1 bit = 4 bits long | ||||||||||||||||||||||||
| Calculate CRC | ||||||||||||||||||||||||||
| data | CRC | |||||||||||||||||||||||||
| 1 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | |||||||||||||
| 1 | 0 | 1 | 1 | 1 | ||||||||||||||||||||||
| 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | |||||||||||||||||||
| 1 | 0 | 1 | 1 | 1 | ||||||||||||||||||||||
| 0 | 0 | 1 | 0 | 1 | 1 | 0 | ||||||||||||||||||||
| 1 | 0 | 1 | 1 | 1 | ||||||||||||||||||||||
| 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | ||||||||||||||||||
| 1 | 0 | 1 | 1 | 1 | ||||||||||||||||||||||
| 0 | 0 | 1 | 1 | 1 | ||||||||||||||||||||||
| Add the CRC extension to the data. | ||||||||||||||||||||||||||
| data | CRC | |||||||||||||||||||||||||
| 1 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 1 | 1 | 1 | |||||||||||||
| Send to destination | ||||||||||||||||||||||||||
| Received at destination | ||||||||||||||||||||||||||
| data | = | 1 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | |||||||||||||||
| generator | = | 1 | 0 | 1 | 1 | 1 | ||||||||||||||||||||
| CRC | = | 0 | 0 | 1 | 1 | 1 | ||||||||||||||||||||
| Check if received data matches it's CRC | ||||||||||||||||||||||||||
| data | CRC | |||||||||||||||||||||||||
| 1 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 1 | 1 | 1 | |||||||||||||
| 1 | 0 | 1 | 1 | 1 | ||||||||||||||||||||||
| 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | |||||||||||||||||||
| 1 | 0 | 1 | 1 | 1 | ||||||||||||||||||||||
| 0 | 0 | 1 | 0 | 1 | 1 | 0 | ||||||||||||||||||||
| 1 | 0 | 1 | 1 | 1 | ||||||||||||||||||||||
| 0 | 0 | 0 | 0 | 1 | 0 | 1 | 1 | 1 | ||||||||||||||||||
| 1 | 0 | 1 | 1 | 1 | ||||||||||||||||||||||
| 0 | 0 | 0 | 0 | 0 | ||||||||||||||||||||||
| The remainder is 0, so the CRC is valid. | ||||||||||||||||||||||||||
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.