sum - display file checksums and block counts
sum [ -o 0|1|2 ] [ -h ] [ filename ... ]
sum outputs three space seperated values: file CRC, file size, and file name. Can be used to find errors in transmitted files. You should not use sum for security checks as they are easily fooled. Look into md5sum for something a bit more secure. If no file names are specified, stdin is used and no file name will displayed in the output.
- -h Display the usage help message.
- -o Specify the output type for file CRC and size.
0--CRC is computed using the CRC 32 algorithm, the default unless otherwise specified. Output size is in bytes.
1--CRC is computed using BSD Historic Algorithm 1 (16-bit checksum with right rotation between byte addition). Output size is number of 1024 byte blocks.
2--CRC is computed using SYSV Historic Algorithm 2 (32-bit checksum). Output size is number of 512 byte blocks.
sum returns 0 on success or 1 if an error occurred.
The program checks the name in which it was called. If it is anything except "cksum", the output will default to BSD Historic Algorithm 1 unless otherwise specified. Otherwise, the default is CRC32 mode.
Algorithms 1 and 2 will round up to the next block count for partial blocks.
CRC 32 algorithm ported directly from OpenBSD cksum C source code.
Perl version rewritten for the Perl Power Tools project from the description of the cksum program in OpenBSD.
Theo Van Dinter (firstname.lastname@example.org)