Sha1sum

sha1sum is a computer program that calculates and verifies SHA-1 hashes. It is commonly used to verify the integrity of files. It (or a variant) is installed by default on most Linux distributions. Typically distributed alongside sha1sum are sha224sum, sha256sum, sha384sum and sha512sum, which use a specific SHA-2 hash function and b2sum, which uses the BLAKE2 cryptographic hash function.

The SHA-1 variants are proven vulnerable to collision attacks, and users should instead use, for example, a SHA-2 variant such as sha256sum or the BLAKE2 variant b2sum to prevent tampering by an adversary.

It is included in GNU Core Utilities, Busybox (excluding b2sum), and Toybox (excluding b2sum). Ports to a wide variety of systems are available, including Microsoft Windows.

Examples
To create a file with a SHA-1 hash in it, if one is not provided:

If distributing one file, the .sha1 file extension may be appended to the filename e.g.:

The output contains one line per file of the form " ". (Note well, if the hash digest creation is performed in text mode instead of binary mode, then there will be two space characters instead of a single space character and an asterisk.) For example:

To verify that a file was downloaded correctly or that it has not been tampered with:

Hash file trees
sha1sum can only create checksums of one or multiple files inside a directory, but not of a directory tree, i.e. of subdirectories, sub-subdirectories, etc. and the files they contain. This is possible by using sha1sum in combination with the  command with the -exec option, or by piping the output from find into. sha1deep can create checksums of a directory tree.

To use sha1sum with find:

Likewise, piping the output from find into xargs yields the same output:

Related programs

 * shasum is a Perl program to calculate any of SHA-1, 224, 256, 384, 512 hashes. It is part of the ActivePerl distribution.
 * sha3sum is a similarly named program that calculates SHA-3, HAKE, RawSHAKE, and Keccak functions.
 * The sum naming convention is also used by the BLAKE team with b2sum and b3sum, by the program, and many others.
 * On FreeBSD and OpenBSD, the utilities are called md5, sha1, sha256, and sha512. These versions offer slightly different options and features. Additionally, FreeBSD offers the Skein family of message digests.