This tutorial explains how to confirm or “match” the MD5 hash of a file in both Windows and macOS, without the need to download or install any software.
Background
Here’s a a very elementary explanation of what MD5 hashes (sometimes called MD5 checksums) are. From Wikipedia –
… MD5 has been employed in a wide variety of security applications, and is also commonly used to check the integrity of files. … An MD5 hash is typically expressed as a 32-digit hexadecimal number.
What does this mean to you? On many download pages, the software company/programmer will provide a 32 character “MD5 hash” or “MD5 checksum”. After you download the program or file, you can compare it’s MD5 hash with the one provided by the source. If they match, you’ll know that you have the correct, unaltered version of that file.
Once upon a time you needed to download and install an app in order to generate the MD5 hash of a file in Windows or macOS. Fast forward to today and now both Windows and macOS have the ability to generate MD5 hashes built right into the operating system. The instructions for Windows are directly below, and you can click here or just scroll down for the section on generating an MD5 hash in macOS.
How to Match an MD5 Hash With a File in Windows
- Click the Search button in your taskbar and enter the word command. When Command Prompt appears in the list of results, select it. You can also open a Command Prompt by clicking the Windows “Start” button and scrolling down to the Windows System folder and then select Command Prompt
- Enter the following partial command but do not hit enter yet.
certutil -hashfile
- Now open a File Explorer window and locate the file that you want to check. Drag that file onto your Command Prompt window and let go.
- Confirm that the line now reads like this:
certutil -hashfile C:\path\to\file.xyz
- Finally, add the characters md5 at the very end of the command, which should now look like this:
certutil -hashfile C:\path\to\file.xyz md5
- Hit enter or return on your keyboard to run the command. After a moment or two the 32 character MD5 hash will be generated and displayed inside of the Command Prompt.
- Now compare that 32 character string with the actual MD5 hash provided by the software company. Assuming they match up, you can rest assured that you’re using the exact copy of the file that was provided by the company/author etc.
- That’s it! Repeat as needed to generate the MD5 hash of any file on your computer.
How to Match an MD5 Hash With a File in macOS
- Launch a Terminal by navigating to your Applications folder, then the Utilities folder, and then open Terminal.
- With a Terminal window open, enter the command: md5 followed by a ‘space’. Do not hit enter/return yet.
- Open a Finder window and locate the file that you want to check. Drag and drop that file onto your Terminal.
- Confirm that the command now looks like this:
md5 /path/to/the/file
- Hit return on your keyboard to run the command. After a moment or two you’ll be presented with the 32 character MD5 hash for that file. Compare that code to the official one to ensure that the files are identical.
- That’s it! Super easy and you can do it with any file you wish.