xref: /titanic_52/usr/src/man/man1/sum.1 (revision a29e56d91db891741f1af9f6bbd3e3c3cac5f19b)
te
Copyright (c) 1992, X/Open Company Limited All Rights Reserved
Copyright 1989 AT&T
Portions Copyright (c) 2009, Sun Microsystems, Inc. All Rights Reserved.
Sun Microsystems, Inc. gratefully acknowledges The Open Group for permission to reproduce portions of its copyrighted documentation. Original documentation from The Open Group can be obtained online at http://www.opengroup.org/bookstore/.
The Institute of Electrical and Electronics Engineers and The Open Group, have given us permission to reprint portions of their documentation. In the following statement, the phrase "this text" refers to portions of the system documentation. Portions of this text
are reprinted and reproduced in electronic form in the Sun OS Reference Manual, from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of Electrical
and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between these versions and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html.
This notice shall appear on any product containing this material.
The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.
See the License for the specific language governing permissions and limitations under the License. When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with
the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
SUM 1 "Aug 11, 2009"
NAME
sum - print checksum and block count for a file
SYNOPSIS

/usr/bin/sum [-abBchHlLpPrRstTw] [-x method] [file...]
"ksh93"

sum [-abBchHlLpPrRstTw] [-x method] [file...]
DESCRIPTION

The sum utility and ksh93 built-in command list the checksum, and for most methods the block count, for each file argument. The standard input is read if there are no file arguments.

The getconf(1) UNIVERSE determines the default sum method: att for the att universe, bsd otherwise. The default for the other commands is the command name itself. The att method is a true sum, all others are order dependent.

Method names consist of a leading identifier and 0 or more options separated by -.

getconf PATH_RESOLVE determines how symbolic links are handled. This can be explicitly overridden by the --logical, --metaphysical, and --physical options below. PATH_RESOLVE can be one of: --logical

Follow all symbolic links.

--metaphysical

Follow command argument symbolic links, otherwise do not follow.

--physical

Do not follow symbolic links.

OPTIONS

The following options are supported for /usr/bin/sum: -a

--all

List the checksum for all files. Use with --total to list both individual and total checksums and block counts.

-b

--binary

Read files in binary mode. This is the default.

-B

--scale=scale

Block count scale (bytes per block) override for methods that include size in the output. The default is method-specific.

-c

--check

Each file is interpreted as the output from a previous sum. If --header or --permissions was specified in the previous sum then the checksum method is automatically determined, otherwise --method must be specified. The listed checksum is compared with the current value and a warning is issued for each file that does not match. If file was generated by --permissions, then the file mode, user and group are also checked. Empty lines, lines starting with #<space>, or the line # are ignored. Lines containing no blanks are interpreted as [no]name[=value] options: method=name

Checksum method to apply to subsequent lines.

permissions

Subsequent lines were generated with --permissions.

-h

--header

Print the checksum method as the first output line. Used with --check and --permissions.

-l

--list

Each file is interpreted as a list of files, one per line, that is checksummed.

-p

--permissions

If --check is not specified then list the file mode, user and group between the checksum and path. User and group matching the caller are output as -. If --check is specified then the mode, user and group for each path in file are updated if necessary to match those in file. A warning is printed on the standard error for each changed file.

-R

--recursive

Recursively checksum the contents of directories.

-t

--total

List only the total checksum and block count of all files. --all --total lists each checksum and the total. The total checksum and block count may be different from the checksum and block count of the catenation of all files due to partial blocks that may occur when the files are treated separately.

-T

--text

Read files in text mode (for example, treat \er\en as \en).

-w

--warn

Warn about invalid --check lines. On by default; -w means --nowarn.

-x

--method|algorithm=method

Specifies the checksum method to apply. Parenthesized method options are readonly implementation details. att|sys5|s5|default

The system 5 release 4 checksum. This is the default for sum when getconf UNIVERSE is att. This is the only true sum; all of the other methods are order dependent.

ast4|32x4|tw

The ast 128 bit PRNG hash generated by catenating 4 separate 32 bit PNRG hashes. The block count is not printed.

bsd|ucb

The BSD checksum.

crc

32 bit CRC (cyclic redundancy check). polynomial=mask

The 32 bit crc polynomial bitmask with implicit bit 32. The default value is 0xedb88320.

done[=number]

XOR the final crc value with number. 0xffffffff is used if number is omitted. The option value may be omitted. The default value is 0.

init[=number]

The initial crc value. 0xffffffff is used if number is omitted. The option value may be omitted. The default value is 0.

rotate

XOR each input character with the high order crc byte (instead of the low order).

size[=number]

Include the total number of bytes in the crc. number, if specified, is first XOR'd into the size. The option value may be omitted. The default value is 0.

prng

32 bit PRNG (pseudo random number generator) hash. mpy=number

The 32 bit PRNG multiplier. The default value is 0x01000193.

add=number

The 32 bit PRNG addend. The default value is 0.

init[=number]

The PRNG initial value. 0xffffffff is used if number is omitted. The option value may be omitted. The default value is 0x811c9dc5.

md4|MD4

RFC1320 MD4 message digest. Cryptographically weak. The block count is not printed. (version) md4 (solaris -lmd) 2005-07-26

md5|MD5

RFC1321 MD5 message digest. Cryptographically weak. The block count is not printed. (version) md5 (solaris -lmd) 2005-07-26

sha1|SHA1|sha-1|SHA-1

RFC3174 / FIPS 180-1 SHA-1 secure hash algorithm 1. Cryptographically weak. The block count is not printed. (version) sha1 (solaris -lmd) 2005-07-26

sha256|sha-256|SHA256|SHA-256

FIPS 180-2 SHA256 secure hash algorithm. The block count is not printed. (version) sha256 (solaris -lmd) 2005-07-26

sha384|sha-384|SHA384|SHA-384

FIPS 180-2 SHA384 secure hash algorithm. The block count is not printed. (version) sha384 (solaris -lmd) 2005-07-26

sha512|sha-512|SHA512|SHA-512

FIPS 180-2 SHA512 secure hash algorithm. The block count is not printed. (version) sha512 (solaris -lmd) 2005-07-26

posix|cksum|std|standard

The posix 1003.2-1992 32 bit crc checksum. This is the default cksum(1) method. Shorthand for crc-0x04c11db7-rotate-done-size.

zip

The zip(1) crc. Shorthand for crc-0xedb88320-init-done.

fddi

The FDDI crc. Shorthand for crc-0xedb88320-size=0xcc55cc55.

fnv|fnv1

The Fowler-Noll-Vo 32 bit PRNG hash with non-zero initializer (FNV-1). Shorthand for prng-0x01000193-init=0x811c9dc5.

ast|strsum

The ast strsum PRNG hash. Shorthand for prng-0x63c63cd9-add=0x9c39c33d.

-L

--logical|follow

Follow symbolic links when traversing directories. The default is determined by getconf PATH_RESOLVE.

-H

--metaphysical

Follow command argument symbolic links, otherwise do not follow symbolic links when traversing directories. The default is determined by getconf PATH_RESOLVE.

-P

--physical

Do not follow symbolic links when traversing directories. The default is determined by getconf PATH_RESOLVE.

-r

--bsd

Equivalent to --method=bsd --scale=512 for compatibility with other sum implementations.

-s

--sysv

Equivalent to --method=sys5 for compatibility with other sum implementations.

-S

--silent|status

No output for --check; 0 exit status means all sums matched, non-0 means at least one sum failed to match. Ignored for --permissions.

OPERANDS

The following operands are supported: file

A path name of a file. If no files are named, the standard input is used.

USAGE

See largefile(5) for the description of the behavior of sum when encountering files greater than or equal to 2 Gbyte ( 2^31 bytes).

ENVIRONMENT VARIABLES

See environ(5) for descriptions of the following environment variables that affect the execution of sum: LC_CTYPE, LC_MESSAGES, and NLSPATH.

EXIT STATUS

The following exit values are returned. 0

Successful completion.

>0

An error occurred.

ATTRIBUTES

See attributes(5) for descriptions of the following attributes:

ATTRIBUTE TYPE ATTRIBUTE VALUE
CSI Enabled
SEE ALSO

cksum(1), getconf(1), ksh93(1), sum(1B), wc(1), zip(1) , libmd(3LIB), attributes(5), environ(5), largefile(5)

DIAGNOSTICS

Read error is indistinguishable from end of file on most devices. Check the block count.

NOTES

Portable applications should use cksum(1). The default algorithm for this command is defined in the POSIX standard and is identical across platforms.

sum and usr/ucb/sum (see sum(1B)) return different checksums.