HOME

TheInfoList



OR:

The SYSV checksum algorithm was a commonly used, legacy
checksum A checksum is a small-sized block of data derived from another block of digital data for the purpose of detecting errors that may have been introduced during its transmission or storage. By themselves, checksums are often used to verify data ...
algorithm. It has been implemented in
UNIX System V Unix System V (pronounced: "System Five") is one of the first commercial versions of the Unix operating system. It was originally developed by AT&T and first released in 1983. Four major versions of System V were released, numbered 1, 2, 3, an ...
and is also available through the sum command line utility. This algorithm is useless on a security perspective, and is weaker than the CRC-32
cksum cksum is a command in Unix and Unix-like operating systems that generates a checksum value for a file or stream of data. The cksum command reads each file given in its arguments, or standard input if no arguments are provided, and outputs the fi ...
for error detection. — manual pages from
GNU GNU () is an extensive collection of free software (383 packages as of January 2022), which can be used as an operating system or can be used in parts with other operating systems. The use of the completed GNU tools led to the family of operat ...
coreutils The GNU Core Utilities or coreutils is a package of GNU software containing implementations for many of the basic tools, such as cat, ls, and rm, which are used on Unix-like operating systems. In September 2002, the ''GNU coreutils'' were cr ...


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 the characteristics 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 FreeBSD pseudocode for this algorithm is: s = sum of all bytes; r = s % 2^16 + (s % 2^32) / 2^16; cksum = (r % 2^16) + r / 2^16; The last part folds the value into 16 bits.


References

{{Reflist


Sources


official GNU sum manual page

coreutils download page
--- find and unpack the newest version of the coreutils package, read src/sum.c Checksum algorithms