How to calculate the hash of files (to check its identity)

Hash of a file or folderThe cryptographic function of hash is a backbone of modern technology that allows, among other things, to ensure the reliability of any sequence of bytes, which can be a website like or any file downloaded from the internet. Specifically, the hashing is a mathematical conversion that transforms a string, of variable size, into a “summary”, hash, of shorter length and constant dimensions; hashing, however, does not allow the opposite conversion, thus guaranteeing the uniqueness of the hashes and avoiding any collisions.

In practical terms, even if there are automatic programs able to do it without having to calculate the hash, it is a very technical way to know if a file (perhaps downloaded from the internet) is really him, to know the unique identity of the file and know if it is clean and safe, intact and in its original version. Knowledge of the hash allows you to establish, for example, with absolute certainty that an image Windows ISO recovered online is an identical copy of the original distributed by Microsoft, without a single bit of difference.

READ ALSO: Check if a file is clean or virus with 30 antiviruses together

Hash verification can be done in 2 ways:

  1. through a program to this equipped with a graphic interface that can also be used directly online;
  2. through the utility native of Windows.

READ ALSO: Check if a file is clean or virus with 30 antiviruses together

Verification via standalone program

HashMyFiles program

One option for the hash calculation is to use onlinemd5, a standalone utility that allows you to generate the hash MD5 of a file and whose use is very simple. It is sufficient, in fact, to choose the file to be checked by clicking on Browse and press the button Calculate MD5 Checksum: the requested hash will appear just below. Typing another hash MD5 inside the white field, the program will check the two hashes and show an informative warning.

A valid alternative can be HashMyiFiles, a small utility that allows you to calculate hash MD5 e SHA1 of one or more files on your system. You can easily copy the list hash MD5 / SHA1 to the clipboard or save them to a text / HTML / XML file.

Furthermore, HashMyFiles it can be started from the Windows Explorer context menu and requires no installation process either file DLL additional. To start using it, simply run the file HashMyFiles.exe and add the files and folders whose hashes you want to view MD5 / SHA1 using options Add files e Add folder in the File menu, or by dragging the files or folder from Explorer in the main window of HashMyFiles. This utility is compatible with Windows 7 / Windows 8 / Windows 10.

Checking hashes using native Windows utilities

Certutil utility nativa Windows

Windows 7 and, above all, the modern Windows 10 include the utility Certutil.exe, that is a multifunction tool through which it is possible to operate on the operating system’s certificate databases and perform different types of cryptographic operations, one of which is used to calculate the hash of any file present in the system.

Identified the file whose hash you want to calculate and trace the path where it resides on the disk via Explorer or the Command Prompt it is possible to hash it SHA1 by typing the following command:

certutil -hashfile percorso_del_file SHA1

Taking the Windows 10 2004 (x64) ISO image as an example, the hash that is returned is

6e436ed102330c9b0272eee1b6619f1056c1756a

the value that can be copied from the Prompt window, pasted on your browser, and verified by a simple web search.

Certutil.exe it can calculate the hash also through other algorithms, such as Md2, Md4, Md5, Sha256, Sha384, Sha512.

Knowing how to use CertUtil allows you to strengthen the security of the IT experience, making the installation of third-party utilities unnecessary to achieve the purpose.

Checking hashes on Linux and Mac

Verify hash on Mac

To calculate the hash of a file or folder on the operating system Linux, you need to type one of the following commands depending on the hash you want to check:

  • md5sum path_to_file
  • sha1sum path_to_file
  • sha256sum path_to_file

While on Mac you will have to type, again depending on the hash you want to check:

  • md5 /path/filename.ext
  • shasum -a 1 /path/filename.ext
  • shasum -a 256 /path/filename.ext

READ ALSO: Disable Windows Smartscreen Exe file lock

LEAVE A REPLY

Please enter your comment!
Please enter your name here