HOME

TheInfoList



OR:

is a
computer program A computer program is a sequence or set of instructions in a programming language for a computer to execute. Computer programs are one component of software, which also includes documentation and other intangible components. A computer program ...
that calculates and verifies
SHA-1 In cryptography, SHA-1 (Secure Hash Algorithm 1) is a cryptographically broken but still widely used hash function which takes an input and produces a 160-bit (20- byte) hash value known as a message digest – typically rendered as 40 hexadec ...
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 are , , and , which use a specific
SHA-2 SHA-2 (Secure Hash Algorithm 2) is a set of cryptographic hash functions designed by the United States National Security Agency (NSA) and first published in 2001. They are built using the Merkle–Damgård construction, from a one-way compression ...
hash function and , which uses the
BLAKE2 BLAKE is a cryptographic hash function based on Daniel J. Bernstein's ChaCha stream cipher, but a permuted copy of the input block, XORed with round constants, is added before each ChaCha round. Like SHA-2, there are two variants differing in t ...
cryptographic hash function. The SHA-1 variants are ''proven'' vulnerable to
collision attack In cryptography, a collision attack on a cryptographic hash tries to find two inputs producing the same hash value, i.e. a hash collision. This is in contrast to a preimage attack where a specific target hash value is specified. There are roughl ...
s, and users should instead use, for example, a SHA-2 variant such as or the
BLAKE2 BLAKE is a cryptographic hash function based on Daniel J. Bernstein's ChaCha stream cipher, but a permuted copy of the input block, XORed with round constants, is added before each ChaCha round. Like SHA-2, there are two variants differing in t ...
variant to prevent tampering by an adversary. It is included in
GNU Core Utilities The GNU Core Utilities or coreutils is a package of GNU software containing implementations for many of the basic tools, such as cat, ls, and rm, which are used on Unix-like operating systems. In September 2002, the ''GNU coreutils'' were ...
,
Busybox BusyBox is a software suite that provides several Unix utilities in a single executable file. It runs in a variety of POSIX environments such as Linux, Android, and FreeBSD, although many of the tools it provides are designed to work with in ...
(excluding ), and
Toybox Toybox is a free and open-source software implementation of over 200 Unix command line utilities such as '' ls'', '' cp'', and '' mv''. The Toybox project was started in 2006, and became a 0BSD licensed BusyBox alternative. Toybox is used for mo ...
(excluding ). 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: $ sha1sum filename ilename2... > SHA1SUM If distributing one file, the
file extension A filename extension, file name extension or file extension is a suffix to the name of a computer file (e.g., .txt, .docx, .md). The extension indicates a characteristic of the file contents or its intended use. A filename extension is typically d ...
may be appended to the filename e.g.: $ sha1sum --binary my-zip.tar.gz > my-zip.tar.gz.sha1 The output contains one line per file of the form " SPACE (ASTERISK, SPACE) SLASH". (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: $ sha1sum -b my-zip.tar.gz d5db29cd03a2ed055086cef9c31c252b4587d6d0 *my-zip.tar.gz $ sha1sum -b subdir/filename2 55086cef9c87d6d031cd5db29cd03a2ed0252b45 *subdir/filename2 To verify that a file was downloaded correctly or that it has not been tampered with: $ sha1sum -c SHA1SUM filename: OK filename2: OK $ sha1sum -c my-zip.tar.gz.sha1 my-zip.tar.gz: OK


Hash file trees

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 in combination with the
find Find, FIND or Finding may refer to: Computing * find (Unix), a command on UNIX platforms * find (Windows), a command on DOS/Windows platforms Books * ''The Find'' (2010), by Kathy Page * ''The Find'' (2014), by William Hope Hodgson Film and t ...
command with the option, or by
piping Within industry, piping is a system of pipes used to convey fluids (liquids and gases) from one location to another. The engineering discipline of piping design studies the efficient transport of fluid. Industrial process piping (and accompa ...
the output from into xargs. can create checksums of a directory tree. To use with : $ find s_* -type f -exec sha1sum '' \; 65c23f142ff6bcfdddeccebc0e5e63c41c9c1721 s_1/file_s11 d3d59905cf5fc930cd4bf5b709d5ffdbaa9443b2 s_2/file_s21 5590e00ea904568199b86aee4b770fb1b5645ab8 s_a/file_02 Likewise, piping the output from into yields the same output: $ find s_* -type f , xargs sha1sum 65c23f142ff6bcfdddeccebc0e5e63c41c9c1721 s_1/file_s11 d3d59905cf5fc930cd4bf5b709d5ffdbaa9443b2 s_2/file_s21 5590e00ea904568199b86aee4b770fb1b5645ab8 s_a/file_02


Related programs

* is a
Perl Perl is a family of two high-level, general-purpose, interpreted, dynamic programming languages. "Perl" refers to Perl 5, but from 2000 to 2019 it also referred to its redesigned "sister language", Perl 6, before the latter's name was offic ...
program to calculate any of SHA-1, 224, 256, 384, 512 hashes. It is part of the
ActivePerl ActivePerl is a distribution of Perl from ActiveState (formerly part of Sophos) for Windows, macOS, Linux, Solaris, AIX and HP-UX. A few main editions are available, including: Community (free, for development use only), and several paid tiers u ...
distribution. * is a similarly named program that calculates
SHA-3 SHA-3 (Secure Hash Algorithm 3) is the latest member of the Secure Hash Algorithm family of standards, released by NIST on August 5, 2015. Although part of the same series of standards, SHA-3 is internally different from the MD5-like struc ...
, HAKE, RawSHAKE, and
Keccak SHA-3 (Secure Hash Algorithm 3) is the latest member of the Secure Hash Algorithm family of standards, released by NIST on August 5, 2015. Although part of the same series of standards, SHA-3 is internally different from the MD5-like stru ...
functions. * The naming convention is also used by the BLAKE team with and , by the program tthsum, and many others. * On FreeBSD and OpenBSD, the utilities are called , , , and . These versions offer slightly different options and features. Additionally, FreeBSD offers the Skein family of message digests.


See also

* * * *
GNU Core Utilities The GNU Core Utilities or coreutils is a package of GNU software containing implementations for many of the basic tools, such as cat, ls, and rm, which are used on Unix-like operating systems. In September 2002, the ''GNU coreutils'' were ...


References


External links

*
sha1sum for Windows announcement

FreeBSD Manual Pages md5

OpenBSD General Commands Manual md5
{{Core Utilities commands Cryptographic software Unix security-related software