You are on page 1of 4




Implementation of “CHECKSUM”

Date of Submission: 4th May, 2010

Submitted by

Apurva Jaipal

Introduction to Error Detection and Correction

In information theory and coding theory with applications in computer science and
telecommunication, error detection and correction or error control are techniques that enable
reliable delivery of digital data over unreliable communication channels. Many
communication channels are subject to channel noise, and thus errors may be introduced
during transmission from the source to a receiver. Error detection techniques allow detecting
such errors, while error correction enables reconstruction of the original data.

The general definitions of the terms are as follows:

• Error detection is the detection of errors caused by noise or other impairments during
transmission from the transmitter to the receiver.
• Error correction is the detection of errors and reconstruction of the original, error-free

The different error detection schemes are:

• Repetition Codes

• Parity Bits

• Checksums

• Cyclic Redundancy Checks

• Cryptographic Hash Functions

The Different error correction schemes are:

• Automatic Repeat Request

• Error Correcting Code(ECC) or Forward Error Correction(FEC)

• Hybrid Schemes
Implementation of Checksum

Suppose our data is a list of five 4-bit numbers that we want to send to a destination.
In addition to sending these numbers, we send the sum of the numbers. For example, if the set
of numbers is (2, 7, 1, 9, 4), we send (2, 7, 2, 9, 4, 23), where 23 is the sum of the original
numbers. The receiver adds the five numbers and compares the result with the sum. If the two
are the same, the receiver assumes no error, accepts the five numbers, and discards the sum.
Otherwise, there is an error somewhere and the data are not accepted.

We can make the job of the receiver easier if we send the negative (complement) of
the sum, called the checksum. In this case, we send (2, 7, 1, 9, 4, −23). The receiver can add
all the numbers received (including the checksum). If the result is 0, it assumes no error;
otherwise, there is an error.

Let us redo the above example using one’s complement arithmetic. The sender
initializes the checksum to 0 and adds all data items (2, 7, 1, 9, 4) and the checksum (0). The
result is 23 (in binary 10111). However, as we can see 23 cannot be expressed in 4 bits. The
extra bit is wrapped and added with the sum to create the wrapped sum value 8 (bin = 1000).
The sum is then complemented, resulting in the checksum value 7 (bin = 0111). The sender
now sends six data items to the receiver including the checksum 7.

The receiver follows the same procedure as the sender. It adds all data items
(including the checksum); (2+7+1+9+4+7) the result is 30(bin = 11110). The sum is wrapped
and becomes 15(bin = 1111). The wrapped sum is complemented and becomes 0(bin = 0000).
Since the value of the checksum is 0, this means that the data is not corrupted. The receiver
drops the checksum and keeps the other data items. If the checksum is not zero, it means that
the data is corrupted and the entire packet is dropped by the receiver. This way, errors in the
received items can be easily detected by the receiver.