How can I validate the file hashes / checksum values for a file I downloaded ?

How can I validate the file hashes / checksum values for a file I downloaded ?

Problem:  How do I validate a file that I have downloaded is the same as what the vendor uploaded to their site ? 

Many sites publish a hash / checksum for files you download.  These can be MD5, SHA-1, SHA256 or SHA512 and each is a string of numbers/letters that make up a unique "fingerprint" of the file downloaded.  The vendor creates the hash / checksum when they upload it and publish it.  When the customer downloads it, they can validate what they downloaded was the exact same file that the publisher uploaded.


Prerequisite(s):
  • Downloaded file
  • MD5 / SHA-1 / SHA256 hash from vendor.
  • Operating system tool that supports generating hash values.

Solutions:  

Each operating system has many different programs for checking/calculating this.  Windows has a utility built in called certutil and it is run from the cmd prompt.

If you downloaded a program from a site and it said the SHA256 hash was 
9626924B54A120182EFD3612554400145B8BA508B4144E95AB3C14FC1F69B7D9

you would type :

certutil -hashfile myfile.exe SHA256 

It may take a few seconds based on your computer speed, but it will show the hash for the file you downloaded.  If it matches what the vendor says then you know you have the exact file the vendor created and it was not modified at all.

Here is an example : 

C:\>certutil -hashfile webNetwork_6.3.0.198-64-Win.exe SHA256
SHA256 hash of file webNetwork_6.3.0.198-64-Win.exe:
96 26 92 4b 54 a1 20 18 2e fd 36 12 55 44 00 14 5b 8b a5 08 b4 14 4e 95 ab 3c 14 fc 1f 69 b7 d9
CertUtil: -hashfile command completed successfully.

Another example : 
C:\>powershell get-filehash -algorithm sha256 webNetwork_6.3.0.198-64-win.exe
Algorithm   Hash         
SHA256          9626924B54A120182EFD3612554400145B8BA508B4144E95AB3C14FC1F69B7D9      


Similar command exist for other operating systems.

On Mac OSX / linux you can type :

md5 filename.ext
shasum -a 1 filename.ext
shasum -a 256 filename.ext