| |||||||||
In computer technology and telecommunication, a checksum is a form of redundancy check, a very simple measure for protecting the integrity of data through error detection. It is used mainly in data storage and networking protocols. It works by adding up the basic components of a message, typically the bytes, and storing the resulting value. Later, anyone who has the authentic checksum can verify that the message was not corrupted by doing the same operation on the data, and checking the sum.
The simplest form of checksum, which simply adds up the bytes in the data, cannot detect a number of types of errors. In particular, such a checksum is not changed by:
More sophisticated types of redundancy check, including Fletcher's checksum, Adler-32, and cyclic redundancy checks, are designed to address these weaknesses by considering not only the value of each byte but also the order of the values. The cost of the ability to detect more types of error is the increased cost of computing the checksum.
These types of redundancy check are useful in detecting accidental modification such as corruption to stored data or errors in a communication channel. However, they provide no security against a malicious agent as their simple mathematical structure makes them trivial to circumvent. To provide this level of integrity, the use of cryptographic message digest algorithms such as SHA-1 or MD5 is necessary.
On UNIX there is a tool called "cksum" that generates both a 32 bit CRC and a byte count for any given input file.