sha1sum
From Wikipedia, the free encyclopedia
It has been suggested that this article or section be merged into SHA hash functions. (Discuss) |
sha1sum is a computer program which calculates and verifies SHA1 hashes. It is commonly used to verify the integrity of files. It is installed by default in most Unix, GNU/Linux and BSD operating systems. Versions for Microsoft Windows do exist (see external links).
Note that some cryptographical weaknesses have been found in SHA1, and in situations where security is important it may be wise to use a better algorithm. However, sha1sum is still very much usable for general-purpose file checksumming, and better than MD5 or a CRC.
[edit] Usage
To calculate the SHA1 hash of a file, simply give the filename as an argument to sha1sum
.
$ sha1sum somefile da39a3ee5e6b4b0d3255bfef95601890afd80709 somefile
The output of sha1sum
can be saved into a text file and used to verify the integrity of a file. If the output above is stored in the file somefile.sha1
, the following command will compare the SHA1 hash of somefile
with the hash stored in somefile.sha1
.
$ sha1sum -c somefile.sha1 somefile: OK
The sha1sum
command can also be used in an interactive mode to calculate the SHA1 hash of any arbitrary string of characters. After typing the sha1sum
command without any arguments, type the string of characters in the terminal. End the string with an End-of-file character. The SHA1 hash will be displayed on the terminal next to the input string. For example:
$ sha1sum somestring CTRL+D CTRL+D
will result in the following output.
$ sha1sum somestringda63fb69aeb03c776bd23e91e2c1cb3df30135d3 -
[edit] See also
- GNU Core Utilities - provides sha1sum for GNU/Linux
- md5sum
- cksum
[edit] External links
- The program's man page
- An implementation for Microsoft Windows
- Mirror for Windows version
- Mirror for Windows version C sourcecode
- The sha1sum program is part of the GNU Core Utilities package
- SlavaSoft FSUM - Fast File Integrity Checker
- JSummer - a platform independent open source message digest tool for Unix/Linux and Windows with a GUI supporting sha1sum and other algorithms.