Checksum and CRC How To
Checkum
Let's have a go!
Video: https://www.youtube.com/watch?v=RFOGDY2e0mQ
-
decide and agree on a number by which we divide by (e.g. 16)
-
take sum of all the numbers
Agree on a number to divide by: 16
Here's some numbers:
25 | 11 | 12 | 7 | 13 | 4 |
First- Take the sum of all of these numbers:
25 + 11 + 12 + 7 + 13 + 4 = 72
So the sum of the numbers is: 72
Secondly find how many 16's can fit into the sum (72).
So 72 / 16 = 4.5
Ignore the remainder.
16 * 4 = 64
Find out what's left when you take the max you can fit into the
sum away from the sum. 72 - 64 = 8.
8 is the checksum of the data!
So that's checksumming! ^
CRC check How to (Cyclic Redundancy Check)
What about a CRC check (Cyclic Redundancy Check)
Video: https://www.youtube.com/watch?v=oPrXPJzbznU
Let's start with the same set of numbers:
25 | 11 | 12 | 7 | 13 | 4 |
Instead of adding them all up, first put them all togeather into
one big long number!
So it becomes: 2511127134
Then divide by the agreed number (we chose 16)
2511127134 / 16 = 156945445.875
Times by the agreed number: 16 * 156945445 = 2511127120
Take the result away from the sum:
2511127134 - 2511127120 = 14
The answer is 14!
Useful checksum & CRC related links
-
This came up when reading about The Limitations of the Ethernet CRC and TCP/IP checksums for error detection and debugging a corruption error.