Intro To 'sha1sum' Command In Linux
2023-06-22 - By Robert Elder
I use the 'sha1sum' command to compute the sha1 checksum of a file or stream:
sha1sum file1.txt
2ef7bde608ce5404e97d5f042f95f89f1c232871 file1.txt
Calculate SHA1 Of A Stream
I can run the 'sha1sum' command on a file, or I can also compute the checksum of a stream by piping data directly into the 'sha1sum' command like this:
echo "Hello World!" | sha1sum
a0b65939670bc2c010f4d5d6a0b3e4e4590fb92b -
Verify SHA1 Sums From List Of Files
If I put the following list of checksums in the file 'sha1-checksums.txt':
2ef7bde608ce5404e97d5f042f95f89f1c232871 file1.txt
0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33 file2.txt
78b371f0ea1410abc62ccb9b7f40c34288a72e1a file3.txt
I can then run the 'sha1sum' command with the '-c' flag to verify the list of checksums like this:
sha1sum -c sha1-checksums.txt
file1.txt: OK
file2.txt: OK
file3.txt: OK
History & Function
The 'SHA1' algorithm is a cryptographic hash function that was developed by the NSA and published in 1995. The algorithm divides the input message into 512 bit blocks, and uses 80 rounds of logical operations on each block to calculate the 160 bit hash output. As of 2023, the 'sha1' hash function is no longer considered to be cryptographically secure. However, 'sha1' is still used by the popular source control tool called 'git' and references to 'sha1' fingerprints can still be found in today's TLS certificates.
And that's why the 'sha1sum' command is my favourite Linux command.
Intro To 'stty' Command In Linux
Published 2023-10-04 |
$1.00 CAD |
Intro To 'nproc' Command In Linux
Published 2023-07-15 |
Intro To 'comm' Command In Linux
Published 2023-09-06 |
How To Force The 'true' Command To Return 'false'
Published 2023-07-09 |
A Surprisingly Common Mistake Involving Wildcards & The Find Command
Published 2020-01-21 |
A Guide to Recording 660FPS Video On A $6 Raspberry Pi Camera
Published 2019-08-01 |
Intro To 'chroot' Command In Linux
Published 2023-06-23 |
Join My Mailing List Privacy Policy |
Why Bother Subscribing?
|