A checksum is the least significant byte of the arithmetic sum of the data being transmitted.
As the data is sent, the transmitting terminal sums it. As the end of the data block, it sends the least significant byte of the sum as an extra character, called the checksum.
The receiver generates its own checksum by summing the data as it is received. At the end of the block, it compares the checksum it generated with the checksum it receives from the sender.
If the two are identical, it is likely that no error occurred.
If the two checksums are different, an error has occurred, and the receiver requests that the block of data is resent.
| Character | M | i | c | r | o | s | o | f | t | Sum | Checksum |
|---|---|---|---|---|---|---|---|---|---|---|---|
| ASCII | 4DH | 69H | 63H | 72H | 6FH | 73H | 6FH | 66H | 74H | 3B6H | B6H |
Checksum routine in C:
char
checksum(const char * block, size_t length)
{
size_t i;
char sum;
for (i = 0; i < length; i++)
{
sum += block[i];
}
return (sum);
}
Back to Error Detection and Correction