This MedLibrary.org supplementary page on Checksum is provided directly from the open source Wikipedia as a service to our readers. Please see the note below on authorship of this content, as well as the Wikipedia usage guidelines. To search for other content from our encyclopedia supplement, please use the form below:
Related Sponsors
A checksum or hash sum is a fixed-size datum computed from an arbitrary block of digital data for the purpose of detecting accidental errors that may have been introduced during its transmissions or storage. The integrity of the data can be checked at any later time by recomputing the checksum and comparing it with the stored one. If the checksums do not match, the data was certainly altered.
The procedure that yields the checksum from the data is called a checksum function or checksum algorithm. A good checksum algorithm will yield a different result, with high probability, when the data is accidentally corrupted; so that, if the checksums match, the data is very likely to be free of accidental errors.
Checksum functions are related to hash functions, fingerprints, randomisation functions, and cryptographic hash functions. However, each of those concepts has different applications and therefore different design goals. Check digits and parity bits are special cases of checksums, appropriate for small blocks of data (such as Social Security numbers, bank account numbers, computer words, single bytes, etc.). Some error-correcting codes are based on special checksums that not only detect common errors but also allow the original data to be recovered in certain cases.
| This article does not cite any references or sources. Please help improve this article by adding citations to reliable sources. Unverifiable material may be challenged and removed. (January 2008) |
Contents |
Simple checksums
The simplest checksum algorithm breaks the data into "words" with a fixed number of bits, and then computes the exclusive or of all those words. The result changes whenever any single bit of the data is flipped, and also when two or more bits in different positions within a word are flipped. However, this checksum is not sensitive to some common errors, such as:
- changing the order of data words;
- inserting or deleting words with all bits set to zero;
- flipping an even number of bits with the same position in the word.
Advanced checksums
More sophisticated types of redundancy check, including Fletcher's checksum, Adler-32, and cyclic redundancy checks (CRCs), are designed to address these weaknesses by considering not only the value of each byte but also its position. The cost of the ability to detect more types of errors is the increased complexity of computing the redundancy check value.
The goal of checksum algorithms is to detect accidental modification such as corruption to stored data or errors in a communication channel. They are not designed to detect intentional corruption by a malicious agent. Indeed, many checksum algorithms can be easily inverted, in the sense that one can easily modify the data so as to preserve its checksum. To guard against malicious changes one should use a cryptographic hash function.
Some checksum algorithms
An example of a simple checksum:citation needed
- Given 4 bytes of data (can be done with any number of bytes): 0x25, 0x62, 0x3F, 0x52
- Step 1: Adding all bytes together gives 0x118.
- Step 2: Drop the carry nibble to get 0x18.
- Step 3: Get the two's complement of the 0x18 to get 0xE8. This is the checksum byte.
- Step 4: To test the checksum byte simply add it to the original group of bytes. The result should be 0x100.
- Step 5: Drop the carry nibble again giving 0x00. Since it is 0x00, this means no error was detected (although an undetectable error could have occurred).
Checksum tools
On Unix systems, there is a tool called "cksum" that generates both a 32-bit CRC and a byte count for any given input file.
See also
- Check digit
- File verification
- Hamming code
- List of checksum algorithms
- Luhn algorithm
- Parity bit
- Frame check sequence
Wikipedia content modification information:
- This page was last modified on 26 November 2008, at 02:27.
Wikipedia Authorship and Review
Wikipedia content provided here is not reviewed directly by MedLibrary.org. Wikipedia content is authored by an open community of volunteers and is not produced by or in any way affiliated with MedLibrary.org.
Wikipedia Usage Guidelines
This article is licensed under the GNU Free Documentation License. It uses material from the Wikipedia article on "Checksum".
The URL for this specific entry is:
All Wikipedia text is available under the terms of the GNU Free Documentation License. (See Copyrights for details). Wikipedia® is a registered trademark of the Wikimedia Foundation, Inc.
