How to Match an MD5 Hash With a File

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

  1. 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
  2. the Windows Search box with the word Command entered into it

  3. Enter the following partial command but do not hit enter yet.

    certutil -hashfile 

  4. a Windows command prompt with part of a command entered

  5. 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.
  6. a Windows File Explorer and a Command Prompt window next to each other

  7. Confirm that the line now reads like this:

    certutil -hashfile C:\path\to\file.xyz

  8. a Command Prompt with most of the command to check a file for an MD5 hash

  9. 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

  10. a command prompt with the full command to check a file for an MD5 hash

  11. 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.
  12. an MD5 hash in Windows used to match with the original md5

  13. 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.
  14. screenshot of a website with MD5 codes for you to match

  15. 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

  1. Launch a Terminal by navigating to your Applications folder, then the Utilities folder, and then open Terminal.
  2. With a Terminal window open, enter the command: md5 followed by a ‘space’. Do not hit enter/return yet.
  3. a macOS Terminal with the md5 command

  4. Open a Finder window and locate the file that you want to check. Drag and drop that file onto your Terminal.
  5. a Finder window and a Terminal next to each other with a line from Finder to the Terminal

  6. Confirm that the command now looks like this:

    md5 /path/to/the/file

  7. a macOS Terminal with the command to match an md5

  8. 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.
  9. an MD5 hash in a macOS Terminal

  10. That’s it! Super easy and you can do it with any file you wish.

If this article helped you, I'd be grateful if you could share it on your preferred social network - it helps me a lot. If you're feeling particularly generous, you could buy me a coffee and I'd be super grateful :)

buy a coffee for simplehelp.net


Home » Security » How to Match an MD5 Hash With a File

Leave a Comment

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