SYSV checksum
Encyclopedia
The SYSV checksum algorithm is commonly used, legacy checksum
algorithms.
It has been implemented in UNIX System V
and is also available through the GNU sum
command line utility.
algorithm) states:
"sum is provided for compatibility; the cksum program is preferable in new applications."
As a result, many common changes to text data are not detected by this method.
The last two lines of the algorithm reduce the total sum to a 16-bit number.
Checksum
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 transmission or storage. The integrity of the data can be checked at any later time by recomputing the checksum and...
algorithms.
It has been implemented in UNIX System V
UNIX System V
Unix System V, commonly abbreviated SysV , is one of the first commercial versions of the Unix operating system. It was originally developed by American Telephone & Telegraph and first released in 1983. Four major versions of System V were released, termed Releases 1, 2, 3 and 4...
and is also available through the GNU sum
Sum (Unix)
Sum is a core GNU utility written by Kayvan Aghaiepour and David MacKenzie and distributed with the UNIX- and Linux-based operating systems. This utility outputs the checksum of each argument file, as well as the number of blocks they take on disk....
command line utility.
Newer checksum algorithms
The manual page of the GNU sum utility program (that implements the BSD checksumBSD checksum
The BSD checksum algorithm is commonly used, legacy checksum algorithms. It has been implemented in BSD and is also available through the GNU sum command line utility.-Newer checksum algorithms:...
algorithm) states:
"sum is provided for compatibility; the cksum program is preferable in new applications."
Description of the algorithm
The main part of this algorithm is simply adding up all bytes in a 32-bit sum. As a result, this algorithm has all weaknesses of a simple sum:- re-arranging the same bytes in another order (e.g. moving text from one place to another place) does not change the checksum.
- increasing one byte and decreasing another byte by the same amount does not change the checksum.
- adding or removing zero bytes does not change the checksum.
As a result, many common changes to text data are not detected by this method.
The last two lines of the algorithm reduce the total sum to a 16-bit number.
Sources
- official GNU sum manual page
- coreutils download page --- find and unpack the newest version of the coreutils package, read src/sum.c