Sum (Unix)
Encyclopedia
Sum is a core GNU
GNU
GNU is a Unix-like computer operating system developed by the GNU project, ultimately aiming to be a "complete Unix-compatible software system"...

 utility written by Kayvan Aghaiepour and David MacKenzie and distributed with the UNIX
Unix
Unix is a multitasking, multi-user computer operating system originally developed in 1969 by a group of AT&T employees at Bell Labs, including Ken Thompson, Dennis Ritchie, Brian Kernighan, Douglas McIlroy, and Joe Ossanna...

- and Linux
Linux
Linux is a Unix-like computer operating system assembled under the model of free and open source software development and distribution. The defining component of any Linux system is the Linux kernel, an operating system kernel first released October 5, 1991 by Linus Torvalds...

-based operating systems. This utility outputs the checksum
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...

 of each argument file
Computer file
A computer file is a block of arbitrary information, or resource for storing information, which is available to a computer program and is usually based on some kind of durable storage. A file is durable in the sense that it remains available for programs to use after the current program has finished...

, as well as the number of blocks
Block (data storage)
In computing , a block is a sequence of bytes or bits, having a nominal length . Data thus structured are said to be blocked. The process of putting data into blocks is called blocking. Blocking is used to facilitate the handling of the data-stream by the computer program receiving the data...

 they take on disk.

According to the manual page, sum uses two different algorithm
Algorithm
In mathematics and computer science, an algorithm is an effective method expressed as a finite list of well-defined instructions for calculating a function. Algorithms are used for calculation, data processing, and automated reasoning...

s for calculating the checksum and blocks, the SYSV checksum
SYSV checksum
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.-Newer checksum algorithms:...

 algorithm and the BSD checksum
BSD 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:...

 (default
Default (computer science)
A default, in computer science, refers to a setting or value automatically assigned to a software application, computer program or device, outside of user intervention. Such settings are also called presets, especially for electronic devices...

) algorithm. Switching between the two algorithms is done via command line options.

The algorithms implemented in this program are less reliable than more modern checksum
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...

 methods.
The GNU manual page states: "sum is provided for compatibility; the cksum
Cksum
cksum' is a command in 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 file's CRC checksum and byte count.The cksum command can be...

 program is preferable in new applications."

The sum utility is invoked from the command line according to the following syntax:
sum [OPTION]... [FILE]...


with the possible option parameters being:
  • -r
    • use BSD checksum
      BSD 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, use 1K blocks (defeats -s)
  • -s, --sysv
    • use SYSV checksum
      SYSV checksum
      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.-Newer checksum algorithms:...

       algorithm, use 512 bytes blocks
  • --help
    • display the help screen and exit
  • --version
    • output version information and exit


When no file parameter is given, or when FILE is -, the standard input is used as input file.
The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK