Calculation of CRC for example

I would like to confirm whether I understood the concept of CRC computing correctly. I will give two examples: the first calculates the remainder using normal subtraction, the second uses this strange XOR material.

Data Bits: D = 1010101010.
Generator bits: G = 10001.

1) Subtraction method for calculating the remainder:

10101010100000 10001||||||||| -----||||||||| 10001||||||| 10001||||||| -----||||||| 000000100000 10001 ----- 1111 

R = 1111.

2) XOR approach:

 10101010100000 10001||||||||| -----||||||||| 10001||||||| 10001||||||| -----||||||| 00000010000| 10001| ------ 000010 

R = 0010.

+4
source share
3 answers

Adding to the end of 1111 does not satisfy the need, as

10927% 17! = 0

.

Note that, by definition, division must be modular division, since it is based on modular mathematics.

+2
source

Both answers are correct. =)

(To double-check the first answer:
10101010100000 (binary) mod 10001 (binary)
= 10912 (decimal) mod 17 (decimal)
= 15 (decimal)
= 1111 (binary).)

+1
source

Subtraction erroneously done. In the binary module, subtraction, addition, division and multiplication are the same. So XOR is correct.

-3
source

Source: https://habr.com/ru/post/1339612/


All Articles