sum - print checksum and block count for a file
/usr/bin/sum [-r] [file...]
The sum lists the checksum for each of its file arguments. The standard input is read if there are no file arguments.
The following option is supported:
Use an alternate (machine-dependent) algorithm in computing the checksum.
The following operands are supported:
A path name of a file. If no files are named, the standard input is used.
See environ(7) for descriptions of the following environment variables that affect the execution of sum: LC_CTYPE, LC_MESSAGES, and NLSPATH.
The following exit values are returned.
Successful completion.
An error occurred.
See attributes(7) for descriptions of the following attributes:
|
cksum(1), digest(1), getconf(1), wc(1), libmd(3LIB), attributes(7), environ(7)
Read error is indistinguishable from end of file on most devices. Check the block count.
Portable applications should use cksum(1). The default algorithm for this command is defined in the POSIX standard and is identical across platforms.
The sum command is typically used to quickly compare a suspect file against a trusted version of the same, such as to ensure that files transmitted over noisy media arrive intact. However, this comparison cannot be considered cryptographically secure. When compatibility with existing sum usage or values is not required, the digest(1) command is recommended instead, as it provides more modern and secure algorithms.
In previous releases of Solaris, there was a /usr/ucb/sum that returned a different checksum than the sum command described here due to different blocksizes and algorithms used. The command sum uses 512 byte block sizes while /usr/ucb/sum used 1024 byte block sizes.