How to view SHA256 on MAC computer

background

Nowadays, when many websites download large files, they used to check the file size to determine whether they were downloaded correctly. However, in many cases, the files are about the same size after downloading, but many times there is a problem that they cannot be installed. There may still be errors in the downloaded files. As a result, the file cannot be used normally, so standard websites provide MD5 or SHA256 methods to check downloaded files (the prerequisite is large files, small files are not necessary) to prevent file errors from being discovered after downloading. (As shown in Figure 1 below, a hash code appears in the downloaded file)

How to operate

I often use MAC computers. In the past, I could calculate the file verification code by directly running the MD5 file. Now I need to calculate the difference between sha256 and MD5. The command method is as follows:

Verify SHA256 checksum using shasum

The shasum command is available on all modern Macs and can be used to check sha256 hashes.

Start a terminal and use the following command, replacing /path/to/file with the appropriate file path:

shasum -a 256 /path/to/file

For example, to check the sha256 hash of a file named "TopSecret.tgz" in the user's downloads folder, you can use the following command:

shasum -a 256 ~/Downloads/TopSecret.tgz

You'll see something like:

9f72726cc19abce9238a0586d5644f6df56378f2214cd55c96d417b2717daf5b ~/Downloads/TopSecret.tgz

The string 9f72726cc19abce9238a0586d5644f6df56378f2214cd55c96d417b2717daf5b is the sha236 hash checksum.

Large strings of numbers and characters are sha256 hashes.

If you are already familiar with the general process of checking hashes, whether checking SHA1 checksums or MD5 hashes, then this process and command may not surprise you, although the latter uses different commands specific to MD5.

Whether you want to verify a SHA-512 checksum, SHA-256 hash, SHA-1 hash, or MD5 checksum, you can do anything from the command line on your Mac. There it is!

Guess you like

Origin blog.csdn.net/qq_29855509/article/details/131620639