Intro To 'sha256sum' Command In Linux
2023-08-30 - By Robert Elder
I use the 'sha256sum' command to compute the SHA256 checksum of a file or stream:
sha256sum file1.txt
7f83b1657ff1fc53b92dc18148a1d65dfc2d4b1fa3d677284addd200126d9069 file1.txt
What Is SHA256?
As of 2023, SHA256 is the most commonly used member of the SHA 2 family of hash functions, and is still considered to be cryptographically secure. The SHA256 algorithm is widely used by many applications, such as the bitcoin consensus algorithm, TLS certificates, and password hashing mechanisms.
SHA256 works by splitting the input message into 512 bit blocks consisting of 16 32 bit values. The hashing process is initialized using these 8 constants:
6a09e667
bb67ae85
3c6ef372
a54ff53a
510e527f
9b05688c
1f83d9ab
5be0cd19
that consist of "the first thirty-two bits of the fractional parts of the square roots of the first eight prime numbers", as described by the FIPS-180 standard.
Then, 64 rounds of logical operations are performed to produce the final 256 bit hash output:
Other Standard Features Of 'sha256sum' Command
All of the SHA family checksums commands support the same flags and features, such as reading input from stdin:
echo "Hello World!" | sha256sum
03ba204e50d126e4674c005e04d82e84c21366780af1f43bd54a37816b6ab340 -
or verifying checksums in the following file 'sha256-checksums.txt':
7f83b1657ff1fc53b92dc18148a1d65dfc2d4b1fa3d677284addd200126d9069 file1.txt
2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae file2.txt
6446d58d6dfafd58586d3ea85a53f4a6b3cc057f933a22bb58e188a74ac8f663 file3.txt
using this command:
sha256sum -c sha256-checksums.txt
file1.txt: OK
file2.txt: OK
file3.txt: OK
And that's why the 'sha256sum' 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?
|