Linux Commands

How to Use Sha512 in Linux

The sha512sum command detects and calculates the SHA512 encrypted message digested on the operating systems like Linux and Unix. It checks or displays a SHA512 checksum for 512-bit. Sha512 reads the digested message from the standard input with FILE (a dash) or without FILE.

If you are interested in knowing the method for using sha512 checksum, please read this guide thoroughly. In this guide, we will explain the complete information about the sha512 and how you can use it in Linux.

How to Use Sha512 in Linux?

Let’s start with the basic syntax command:

sha512sum [option].... [file]

There are four options that you can use in the previous syntax. All the four options are helpful for you only when verifying the checksums. Now, let’s take a look at the different use of sha512 with the appropriate examples:

Example 1:

You can read your file in the default or text modes using any of the following commands:

sha512sum --text <file name>

Or

sha512sum -t <file name>

As you can see in the previous image, both commands printed the same encrypted message for a specific file.

Example 2:

For creating a BSD-style checksum, you can use the following option with sha512:

sha512sum --tag <file name>

Example 3:

You can easily check the sha512sum format of any file by executing any of the following commands in the terminal:

sha512sum --check <file name>

Or

sha512sum -c <file name>

Example 4:

If you want to check the binary code of any file with sha512sum, then use the following command:

sha512sum --binary <file name>

sha512sum -b <file name>

Note: There is no difference between the text and the binary mode options on the GNU system.

Example 5:

You can run the following commands to warn about the improperly formatted checksum lines:

sha512sum --warn

Or

sha512sum -w

The previous command displays all the warnings related to the improperly formatted checksum files.

Example 6:

To exit the non-zero inappropriately for formatted checksum lines, use the following option for sha512sum:

sha512sum --strict

Example 7:

The following option does not show any output after running the following command. It successfully shows success:

sha512sum --status

You can use the following option to not print OK for each successfully verified file:

sha512sum --quiet

The sums are calculated as described in FIPS-180-2. While checking, the previous output of this program should be its input. In the default mode, the checksum prints a single line, showing the name for each file and a character for the input mode (space for text, ‘*’ for binary).

Bonus Tip

You can use the following command to get the version-related information of sha512sum:

sha512sum --version

You can check the complete help guide of sha512 by running the following command:

sha512sum --help

Conclusion

In Linux, the sha512sum command is used to evaluate the Sha512 encrypted message from the terminal. The sha512 command has many options to get the in-depth information about encrypted messages. In this guide, we included a brief information about the sh512sum and the different examples to use it in Linux.

About the author

Prateek Jangid

A passionate Linux user for personal and professional reasons, always exploring what is new in the world of Linux and sharing with my readers.