Many vendors provide a hash value along with the file download itself. These hash values were previously generated using SHA1 or MD5 hash algorithms, but these hash algorithms have become weaker as computers have become faster and vulnerabilities have been identified in the hash algorithms. For these reasons hash values are typically generated using SH256 or stronger hash algorithms.
The idea is to generate the hash value on your computer using the file downloaded and compare it against the hash value published on the vendor’s web site. This validates that the file downloaded has not modified while it was in-transit over the Internet. In other words, have you downloaded the same file onto your computer that the vendor has published on their web site? There are two tools to generate the hash value of a downloaded file on Microsoft Windows. Both FCIV and CertUtil are available from Microsoft for free and are command line utilities.
Of course, an attacker could modify both the file download and the hash value published on their website. In this case there is no indication that the file download and the hash value have been compromised. For example, this happened to Linux Mint in February 2016 in a ‘supply chain’ style attack:
FCIV stands for ‘File Checksum Integrity Verifier’ and was released in May 2004. It is a separate utility that can be downloaded from Microsoft. The ‘fciv.exe’ file then needs to be made available through the system environment variables in Microsoft Windows.
FCIV is a short, concise command. However, it can only compute SHA1 and MD5 hash algorithms. This makes it unsuitable for modern hash values that use stronger hash algorithms.
fciv [hash_algorithm] [hash_file] C:>fciv -sha1 "./hello-world.txt" // // File Checksum Integrity Verifier version 2.05. // b6fe6281d53e8a66d6ab47e0a39a809dad901a0e ./hello-world.txt
CertUtil is a powerful command included in Microsoft Windows as part of Certificate Services. No download or modification of the system environment variables is required. More information about the command is available here:
CertUtil is a longer command. However, it supports MD2, MD4, MD5, SHA1, SHA256, SHA384, and SHA512. It also seems to receive updates by Microsoft.
certutil -hashfile [hash_file] [hash_algorithm] C:>certutil -hashfile "./hello-world.txt" sha1 SHA1 hash of ./hello-world.txt: b6fe6281d53e8a66d6ab47e0a39a809dad901a0e CertUtil: -hashfile command completed successfully.
We hope this helps,