How to Use Sha512 on Linux

How to Use Sha512 on Linux

Looking for a solution on how to use the sha512 command in Linux? Here’s everything you need to know about the command which detects and calculates the SHA512 encrypted message. 

In Unix-based operating systems, you can use secure hashing algorithms such as the sha512sum command to verify and compute the message digest or hash of any file or content. The user can provide any specific file as input on the command prompt

Alternatively, when no file is provided, the command reads the content from standard input or output for which the message digest can be computed. The size of the message digest or checksum is 512 bit for sha512.

What is a message digest?

The digest of a message is generated in hexadecimal format using any cryptographic algorithm such as Rivest Shamir and Adleman (RSA), elliptic curve cryptography (ECC), etc. You can also use it to generate and verify digital signatures. 

Various protocols such as transport layer security (TLS), secure socket layer (SSL), pretty good privacy (PGP), and secure shell (SSH) use message digest for their internal working. In addition, a message digest can also be used for authenticating users by calculating the hash of passwords.

The following is an example of a message digest:

message digest

A message digest can be used to check if a file has been corrupted or changed. For instance, during transmitting a message or file from one computer to another.

How to Use Sha512 on Linux

You can use one of four alternatives in the given syntax. Only when you are checking the checksums will all four options be helpful to you. Let’s now examine the various applications of sha512 using these proper examples:

Basic Usage

To compute a message digest, you should use the following syntax:

sha512sum [OPTION]... [FILE]...

The name of the file is optional. In addition, there are several other options that can be additionally supplied, which is what we will discuss in the next part.

Checking the version

To check that the sha512sum is available on the system along with the version information, type in the following command.


sha512sum --version

Reading the file in text mode

One can use the -t or --text option to read the file in text mode, which is the default mode. The following command reads a file in text mode:

sha512 --text file

Another way of reading in text file mode is as follows.


sha512sum -t file

Creating BSD style checksum

One can also create a BSD-style checksum using the --tag option as follows.


sha512sum --tag file

Verifying a checksum

After creating the checksum of any file, it can be checked or verified by using the --check option as seen below.


sha512sum --check file 

The same can also be done with the following command:

sha512sum -c file

Checking the binary code of the file

To check the file’s binary code, use the following command.


sha512sum --binary file

You can also achieve the same output using the following command:

sha512sum -b file

Warning on improperly formatted checksum

You can execute the following commands to warn the system about improperly formatted checksum lines in the file:

sha512sum --warn


sha512sum -w

Alternatively, to let the system exit on an improperly formatted checksum, you can use the following command:

sha512 --strict

Showing only a success message

If you want the system to display only a success message and not show any output after running the command, you can use the --status option as follows:

sha512sum --status

Additional Notes

  • The sums are described and computed in FIPS-180-2. When running a check, the input must be a former output of the program. The default mode is to print a line with a checksum, a space, a character showcasing the input mode (‘*’ for binary, ‘ ‘ for text or where the binary is irrelevant), and the name for each FILE.
  • SHA1 is the preferred digest for all new applications. However, other digests continue to be frequently utilized.
  • Dgst will automatically choose the signature algorithm (RSA, ECC, etc.) based on the ASN.1 information in the private key when signing a file. When verifying signatures, it solely deals with the RSA, DSA, or ECDSA signature itself. 

It ignores any associated data used in formats like x.509, CMS, and S/MIME to identify the signer and algorithm.

  • In particular, ECDSA and DSA signature algorithms call for a supply of random numbers.
  • Only a single file should be signed or verified when using the signing and verify options.
  • OpenSSL cannot validate hex signatures. Instead, translate the hex using a tool like “xxd -r“.

This post discusses how to use sha512 on Linux and how it can be used to compute and determine the integrity of any file in Unix-based systems. We also discussed the various options that can be used with the command. 

Other commands can be used to generate a message digest available such as md5sum, sha224sum, sha256sum, and sha384sum. If you want to know more information about sha, you can obtain it by consulting the Unix manual.

If this guide helped you, please share it.

Leave a Reply
Previous Article
How to Split Binary Files on Linux

How to Split Binary Files on Linux

Next Article
How to Kill all Python Processes on Linux

How to Kill All Python Processes on Linux

Related Posts