To ensure the integrity of a file during the transfer, we can verify its hash or checksum if the sender or uploader of a file has provided that hash for the uploaded file. They are digital signature-based encryption systems to check the integrity of files. If the signatures of the original file and your copy of the file don’t match, it means your copy of the file may have corrupted or has been compromised. There are a number of hash checksum algorithm formats including MD5, SHA1, SHA256, SHA384, SHA512, SFV, CRC, Base64, LM, etc. MD5, SHA1, and SHA256 are the most widely used checksums to verify data integrity. In an earlier post, we discussed how we can check SHA256 checksum of a file on Mac. In this tutorial we will show you how to find MD5 checksum of a downloaded file in Mac using the terminal, a built-in tool on Mac OS.
There are several ways you can find and open the terminal app on Mac. For example, you can open your Applications folder, then open Utilities sub-folder and double-click on Terminal to start it; you can search for “terminal” in Spotlight Search; it can also be found in the Other folder in Launchpad.
To check the MD5 checksum value of a file using the following command in the Terminal.
To find out the path to the file, open Finder, find the file, and right click on it, then choose Get Info from the context menu. The file properties opens and provides you the file type, file size, file location, created date, modified date, file source, name & extension and other information. In fact, you can simply drag the file from Finder and drop it to the Terminal window, you will see that the file path and name inserted automatically in Terminal. Press Enter or Return key on the keyboard to execute the command line, you will then get the MD5 checksum of the file.
Compare the MD5 hash with the one you find from the source where you downloaded the file to verify its integrity. If the two strings do not match, discard the file and attempt the download again.