Verifying SHA-512, SHA-256, SHA-1 and MD5 checksum on Mac using Terminal
Photo by Thomas Q on Unsplash
What is a checksum?
A checksum is a sequence of numbers and letters derived from a piece of stored or transmitted digital data for the purpose of detecting errors that may have been introduced during its transmission or storage. It is usually applied to an installation file after it is received from the download server. So if you know the checksum of an original file, you can use it to check whether your copy of the file is identical or not.
To verify the checksum on your Mac first you need to open Terminal app. The Terminal app is in the Utilities folder in Applications. To open it, either open your Applications folder, then open Utilities and double-click on Terminal, or press Command and Spacebar to launch Spotlight and type ?Terminal? then double-click the search result or simply press Enter.
Before you start verifying the specific checksum
To verify the specific checksum you should type the specific command to verify that checksum followed by /the/full/path/to/your/file.
The full path to your file should include the file extension. Instead of typing the full path you can just drag and drop the file to the Terminal.
For example: Let?s say you downloaded your file to the Downloads folder. Then the full path should look like this:
/Users/Username/Downloads/file-name.extension
Or like this:
~/Downloads/file-name.extension
The symbol ~ (Tilde) in virtually all modern Unix shells is shorthand for your home directory. On OS X or macOS, this expands to /Users/Username.
Verifying SHA-512 checksum
Method 1:
- Type the following command in your Terminal:
shasum -a 512 /full/path/to/your/file
Or you can type the command shasum -a 512 followed by space and drag and drop the file to the Terminal.
Example:
shasum -a 512 /Users/Username/Downloads/clear-30390-live-desktop.iso.xz
It should look like this:
Verifying SHA-512 checksum on Mac
2. Press Enter
Wait a while and you should see the checksum on a new line followed by /the/full/path/to/your/file.
It should look like this:
SHA-512 checksum on Mac
3. Copy the checksum
Copying SHA-512 checksum on Mac
and verify if it?s identical with the original one. You can use Diffchecker to find any deferences between them.
Method 2: Using OpenSSL to verify SHA-512
- Type the following command in your Terminal:
openssl sha512 /full/path/to/your/file
Or you can type the command openssl sha512 followed by space and drag and drop the file to the Terminal.
Example:
openssl sha512 /Users/Username/Downloads/clear-30390-live-desktop.iso.xz
It should look like this:
Verifying SHA-512 checksum on Mac using OpenSSL
2. Press Enter
Wait a while and you should see SHA512(/the/full/path/to/your/file)= followed by the checksum.
It should look like this:
SHA-512 checksum on Mac verified using OpenSSL
3. Copy the checksum
Copying SHA-512 checksum on Mac verified using OpenSSL
and verify if it?s identical with the original one. You can use Diffchecker to find any deferences between them.
Verifying SHA-256 checksum
Method 1:
- Type the following command in your Terminal:
shasum -a 256 /full/path/to/your/file
Or you can type the command shasum -a 256 followed by space and drag and drop the file to the Terminal.
Example:
shasum -a 256 /Users/Username/Downloads/clear-30390-live-desktop.iso.xz
It should look like this:
Verifying SHA-256 checksum on Mac
2. Press Enter
Wait a while and you should see the checksum on a new line followed by /the/full/path/to/your/file.
It should look like this:
SHA-256 checksum on Mac
3. Copy the checksum
Copying SHA-256 checksum on Mac
and verify if it?s identical with the original one. You can use Diffchecker to find any deferences between them.
Method 2: Using OpenSSL to verify SHA-256
- Type the following command in your Terminal:
openssl sha256 /full/path/to/your/file
Or you can type the command openssl sha256 followed by space and drag and drop the file to the Terminal.
Example:
openssl sha256 /Users/Username/Downloads/clear-30390-live-desktop.iso.xz
It should look like this:
Verifying SHA-256 checksum on Mac using OpenSSL
2. Press Enter
Wait a while and you should see SHA256(/the/full/path/to/your/file)= followed by the checksum.
It should look like this:
SHA-256 checksum on Mac verified using OpenSSL
3. Copy the checksum
Copying SHA-256 checksum on Mac verified using OpenSSL
and verify if it?s identical with the original one. You can use Diffchecker to find any deferences between them.
Verifying SHA-1 checksum
Method 1:
- Type the following command in your Terminal:
shasum -a 1 /full/path/to/your/file
Or you can type the command shasum -a 1 followed by space and drag and drop the file to the Terminal.
Example:
shasum -a 1 /Users/Username/Downloads/clear-30390-live-desktop.iso.xz
It should look like this:
Verifying SHA-1 checksum on Mac
2. Press Enter
Wait a while and you should see the checksum on a new line followed by /the/full/path/to/your/file.
It should look like this:
SHA-1 checksum on Mac
3. Copy the checksum
Copying SHA-1 checksum on Mac
and verify if it?s identical with the original one. You can use Diffchecker to find any deferences between them.
Method 2: Using OpenSSL to verify SHA-1
- Type the following command in your Terminal:
openssl sha1 /full/path/to/your/file
Or you can type the command openssl sha1 followed by space and drag and drop the file to the Terminal.
Example:
openssl sha1 /Users/Username/Downloads/clear-30390-live-desktop.iso.xz
It should look like this:
Verifying SHA-1 checksum on Mac using OpenSSL
2. Press Enter
Wait a while and you should see SHA1(/the/full/path/to/your/file)= followed by the checksum.
It should look like this:
SHA-1 checksum on Mac verified using OpenSSL
3. Copy the checksum
Copying SHA-1 checksum on Mac verified using OpenSSL
and verify if it?s identical with the original one. You can use Diffchecker to find any deferences between them.
Verifying MD5 checksum
MD5 is no longer recommended as a checksum hash for security reasons, but some legacy programs may still use it.
Method 1:
- Type the following command in your Terminal:
md5 /full/path/to/your/file
Or you can type the command md5 followed by space and drag and drop the file to the Terminal.
Example:
md5 /Users/Username/Downloads/clear-30390-live-desktop.iso.xz
It should look like this:
Verifying MD5 checksum on Mac
2. Press Enter
Wait a while and you should see MD5 (/the/full/path/to/your/file) = followed by the the checksum.
It should look like this:
MD5 checksum on Mac
3. Copy the checksum
Copying MD5 checksum on Mac
and verify if it?s identical with the original one. You can use Diffchecker to find any deferences between them.
Method 2: Using OpenSSL to verify MD5
- Type the following command in your Terminal:
openssl md5 /full/path/to/your/file
Or you can type the command openssl md5 followed by space and drag and drop the file to the Terminal.
Example:
openssl md5 /Users/Username/Downloads/clear-30390-live-desktop.iso.xz
It should look like this:
Verifying MD5 checksum on Mac using OpenSSL
2. Press Enter
Wait a while and you should see MD5(/the/full/path/to/your/file)= followed by the checksum.
It should look like this:
MD5 checksum on Mac verified using OpenSSL
3. Copy the checksum
Copying MD5 checksum on Mac verified using OpenSSL
and verify if it?s identical with the original one. You can use Diffchecker to find any deferences between them.