How, why, and why you should hash check

What is a hash check?

Here at BestVPN we often recommend software designed to improve your security and privacy, and almost invariably (with the exception of custom VPN clients, where we have our reasons), we strongly recommend using open source programs that can be independently audited for malicious code.

This is great, and provides the best security we know of to guarantee the code has not been tampered with, but the question remains (especially when downloading apps from third party websites) – how do we know the file(s) haven’t been tampered with by a third party?

The answer is – because they can be verified using cryptographic hashes (also sometimes referred to a checksums) – usually MD5 or SHA1, but occasionally stronger hashes may be encountered (such as SHA2 or SHA3). Unfortunately, despite being perhaps the most common form of hashing, MD5 is broken, and therefore cannot be trusted (more on this later).

A cryptographic hash is a derived from the contents of a file, creating a unique ‘fingerprint’ that will change if the file changes,

A single bit change in the pre-image [i.e. the file you’re hashing] changes, on the average, half of the bits in the hash value’, Schneier, section 2.4.

On the reverse side of the equation, it is computationally impossible to derive the contents of a file from its hash value.

Why you should check it

Even a tiny change in a file will dramatically change its hash value, so when you check a file’s hash value against the value published by its developers, you can easily verify that the file you have downloaded is exactly the same untampered file the developers intended you to download. This is why all good developers supply a cryptographic hash for their downloads.

Note that hashes also verify that files have not become corrupted, although it is the security aspect we are most interested in here.

Also note that hashing is used for all sorts of cryptographic purposes, such as verifying encryption keys during VPN handshakes. This, however, is performed automatically between computers and happens ‘under the hood’, so is likewise not the focus of this article.

How you can check it

To check a file’s cryptographic hash integrity, make a note of the hash number published by the developer, generate the hash value of the file you have, and compare the two. If they are identical then you have the file the developer intended you to have, and if not then it has either become corrupted or been tampered with.

Linux and OSX have a hash function built-in, while Windows users need to download some software.


  1. Open Terminal
  2. Type ‘openssl md5 ’ and press ‘enter. Alternatively, type ‘openssl md5’, then drag and drop the target file into the Terminal window, and press enter
  3. The MD5 hash value will now be displayed.

‘md5’ can be replaced with the name of the hash function you require e.g. ‘openssl sh2

Linux (debian)

  1. Open Terminal
  2. Type ‘md5sum ’and hit enter
  3. The MD5 hash value will now be displayed.

As with the Linux instructions above, ‘md5’ can replaced with the type of hash value you require. Type ‘man dgst’ into Terminal to see what hash functions your system supports.


File Checksum Integrity Verifier (FCIV)

This command line tool is available from Microsoft, and can compute MD5 or SHA-1 cryptographic hash values.

  1. Open a command prompt and navigate to where the file is located
  2. Type ‘fciv.exe ’and hit enter
  3. The MD5 hash value will now be displayed.

To find an SH1 hash value instead, type ‘fviv.exe -sha1 ’.

Fsum frontend

The most popular Windows GUI hashing tool is HashTab, but this is no longer open source (although Windows users may download it free for personal use). Fsum Frontend is open source however, includes hash compare functions, and supports 96 hash algorithms!

Fsum Frontend

Hash function weaknesses

It is important to understand that verifying a file’s hash function is a relatively weak form of data integrity, as it does not verify the origin of the file. It is possible, for example, for a hacker not only to have compromised the file you are downloading, but to have hacked the developers’ website into showing the hash function of the compromised file.

In this case, verifying the hash function only verifies that you have downloaded a compromised file. A much more secure mechanism is the use of Digital signatures, which we will discuss in detail here.

Another problem is that hash functions themselves may contain mathematical vulnerabilities. The web’s most commonly used algorithm, for example, MD5, is known to have a ‘collisions in executables’ flaw, which means that it is effectively broken. Because of this, SSL certificate authorities, software companies, and most other security-minded organizations have discontinued its use, but it otherwise remains very popular.

SHA1 is much more robust, but SHA2 and SHA3 are considered more secure.


Checking a file’s cryptographic hash function is a very useful way to establish its basic integrity, as long as you bear in mind that,

‘We cannot use [one-way hash functions] to determine with certainty that the two strings are equal, but we can use them to get a reasonable assurance of accuracy.’ (Schneier, section 2.4).

Far more secure than hash checking is verifying digital signatures. Check out my article on Digital signatures – why and how you should use them for more information.

Douglas Crawford I am a freelance writer, technology enthusiast, and lover of life who enjoys spinning words and sharing knowledge for a living. You can now follow me on Twitter - @douglasjcrawf.

Related Coverage

Leave a Reply

Your email address will not be published. Required fields are marked *