Networking, Programming, Linux & Cats

Error Detection – Checksum

Both devices needs to agree on checksum number – will it be odd or even

The higher the number is the more precise is the check

Let’s take the example from one of YouTube videos with a great explanation of how Checksum is working.

Taking the numbers which we want to transmit :

25 11 12 7 13 4

Both devices should agree on checksum – let it be number 16

Sum up the numbers 25+11+12+7+13+4=72

Divide them by checksum 72/16=4.5(ignore what is after the .) so we have 4

4*16=64 = 72 – 64 = 8

Now 8 is a checksum

First device takes the numbers and writes them to tcp/ip stack, puts also the number 8 to the checksum field – to transmit it with actual message, this part helps to know if the rest of message is correct and right

Second device reads the numbers from tcp/ip stack and performs the checksum check, if it get’s the same value = 8 that means that data wasn’t corrupted and we can trust it.

This is a very fast check to compute, but unfortunately checksum is not robust and not reliable it can help only against single bit error.

For example if we would send 25 11 12 7 13 4 but message will arrive as 24 12 12 7 13 4 it will also be 72 and checksum won’t detect any problems here.