In computer technology, a checksum is a very simple integrity-protection measure. It is used mainly in data storage, and networking protocols.

It works by adding up the bytes, or some other basic components in a string of data, 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".

Checksums cannot detect a number of types of error. In particular, a checksum is not changed by:

  • reordering of the bytes in the message
  • inserting or deleting zero-valued bytes
  • multiple errors which increase and decrease the checksum in opposite direction

Note: The term "checksum" is also often used incorrectly to mean a cyclic redundancy check (CRC). CRCs were developed to remedy some of the defects of simple checksums, and are in general more effective than checksums at detecting random errors. CRCs can be implemented almost as efficiently as checksums. On UNIX there is a tool called "cksum" that generates both a 32 bit CRC and a byte count for any given input file.

While both checksums and CRCs are somewhat useful in protecting against accidental modification, they provide no security against a malicious agent as their simple mathematical structure makes them both trivial to circumvent. Therefore, the use of a cryptographically strong hash functions such as MD5 is often necessary instead of a checksum or CRC.

See also Parity, CRC, CRC32, Cryptography, Threat model, Luhn formula, check digit