How to generate Checksum of a file with different SHA2 Hash functions in Linux and Windows

Updated on September 2, 2017

Checksums are hashes used to confirm both the file integrity and authenticity. A Hash is not ‘encryption’. It is (sometimes called digest) a kind of ‘signature’ for a text or a data file. SHA-1 generates 160 bits, SHA256 generates 256-bit (32 byte), whereas SHA512 generates 512 bits signature for a text/data. SHA224, SHA256, SHA384, SHA512 are successor hash functions to SHA-1. SHA-2 functions are the strongest hash functions available, while SHA-1 has been broken !

Lets learn how to generate Checksum (Hash) of a file with different SHA-2 Hash functions

Linux Distros

Most Linux distributions come with the different programs like sha1sum, sha224sum, sha256sum, sha384sum, sha512sum etc., to verify data integrity using the respective SHA algorithms. On Ubuntu, Debian, CentOS, RedHat, Fedora etc., it is part of the coreutils package. (Click here to understand what package contains sha1sum, sha224sum executable)

List SHA programs on your Linux distros:

Type sha and press tab to list the different SHA programs as shown below:

[root@cloud9 ~]$ sha + [Press Tab]
 sha1sum    sha224sum  sha256sum  sha384sum sha512sum  shasum

Generate checksum using SHA1

[root@cloud9 ~]$ sha1sum [filename]
 Example:
 [root@cloud9 ~]$ sha1sum index.php
 93b2f34d155fcffdfdbbcbb2a52ad4cd6edf9686  index.php

Generate checksum using SHA224

[root@cloud9 ~]$ sha224sum index.php
 0592a4c97678c6b2be67c170a8b0d228bec60a4d6c166e02089c513a  index.php

Generate checksum using SHA256

[root@cloud9 ~]$ sha256sum index.php
 b6722a6c552fca05db2a0cfcf7915485cb660995584ddf60af08088e85a19027  index.php

Generate checksum using SHA384

[root@cloud9 ~]$ sha384sum index.php
 c74b7d29f4864d8cf157d6d84d087314eeca6217352bce992708e9959e675a194abe7ed5c4efea1adc6a08b198e2f5c9  index.php

Generate checksum using SHA512

[root@cloud9 ~]$ sha512sum index.php
 ac861d194aa0f9946d372b1b0573f62a4b5de6bd57e2f15e5aaed9d76e7e3863b5a988679d90e23707052abf694d0399e00f27dc8b0fee157510d278e21fa8ac  index.php

Windows

Well, Penteract’s free File Checksum Verifier (Step 1, contains the download link) is one of the most user-friendly programs out there for Windows. Some of its advantages are:

1. It has the capability to compare the calculated and expected hashes for you.
2. Very Minimalistic
3. Offline – You don’t need to upload your files
4. User-friendly – Drag and drop a file
5. Supports MD5, SHA1, SHA256, SHA384, SHA512 and RIPEMD160

Step 1: Download Penteracts file checksum verifier for windows and Install it.

Step 2: Start the program from the start menu and you would see the below window:

Penteract file checksum generate for windows
Penteract file checksum generate for windows

Step 3: Choose the Hash-type from the drop down menu.

Step 4: Drag and Drop the file for which checksum has to be generated/compared.

Step 5: Press the Compute button. You would get the Checksum of the file:

Step 6: You can also verify the file integrity by comparing with its expected checksum as shown below:

Compare Checksum of a file using penteract file checksum verifier on windows
Compare Checksum of a file using penteract file checksum verifier on windows

Was this article helpful?

Related Articles

Leave a Comment