Intro To 'sha512sum' Command In Linux
2023-09-13 - By Robert Elder
I use the 'sha512sum' command to compute the SHA 512 checksum of a file or stream:
sha512sum file1.txt
861844d6704e8573fec34d967e20bcfef3d424cf48be04e6dc08f2bd58c729743371015ead891cc3cf1c9d34b49264b510751b1ff9e537937bc46b5d6ff4ecc8 file1.txt
SHA 512 Versus SHA 256
SHA 512 is extremely similar to SHA 256. The differences are mostly found in the block sizes:
Algorithm Message Size (bits) Block Size (bits) Word Size (bits) Message Digest Size (bits)
SHA-256 < 2^64 512 32 256
SHA-512 < 2^128 1024 64 512
Source: Figure 1 in Secure Hash Algorithm Properties, page 3 of fips180-3_final.pdf.
Since the working variable size of SHA 512 is 64 bits instead of 32, many of the bit shift and rotation values are also different:
In addition, the SHA 512 algorithm uses 80 calculation constants instead of the 64 that SHA 256 uses. SHA 512 uses 80 rounds of computation instead of the 64 that SHA 256 uses.
According to section 5.3.5 SHA-512 of fips180-3_final.pdf, the initial 8 hash values of SHA 512 come from "the first sixty-four bits of the fractional parts of the square roots of the first eight prime numbers." Some would argue that having a larger output bit size and using more computation rounds would make SHA 512 more secure than SHA 256.
Other Standard Features Of 'sha512sum' Command
All of the SHA family checksums commands support the same flags and features, such as reading input from stdin:
echo "Hello World!" | sha512sum
830445e86a0cfafac4e1531002356f384847a11a7456fb8ccb81ab36e37bff28f34fa2c5bfdd347e964c5c5df0fc305de6394368219307b2ceeb0ec84b7c2b31 -
or verifying checksums in the following file 'sha512-checksums.txt':
861844d6704e8573fec34d967e20bcfef3d424cf48be04e6dc08f2bd58c729743371015ead891cc3cf1c9d34b49264b510751b1ff9e537937bc46b5d6ff4ecc8 file1.txt
f7fbba6e0636f890e56fbbf3283e524c6fa3204ae298382d624741d0dc6638326e282c41be5e4254d8820772c5518a2c5a8c0c7f7eda19594a7eb539453e1ed7 file2.txt
8046964934182f830cc5286c28c13c697960b9d2b77620467a5039a2c3285ca4444cb05d1ee0641a54d664a75bca822aba52e0ca2e87bc86f1b013ba9e67c7e7 file3.txt
sha512sum -c sha512-checksums.txt
file1.txt: OK
file2.txt: OK
file3.txt: OK
And that's why the 'sha512sum' 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?
|