• Skip to primary navigation
  • Skip to main content
Sal Ferrarello
  • About Sal Ferrarello
  • Speaking
  • Connect
    Mastodon GitHub Twitter (inactive)
You are here: Home / Dev Tips / Checksum on Mac OS X Command Line

Checksum on Mac OS X Command Line

Last updated on June 11, 2018 by Sal Ferrarello

The checksum is like a fingerprint for the file. A file is processed through a known algorithm which results in the checksum, a.k.a “hash”, which is a string of letters and numbers unique to that file, e.g. 8ab686eafeb1f44702738c8b0f24f2567c36da6d.

If the file is modified, the resulting checksum will be different. This allows a quick way to ensure a file has not be modified.

Often when a webpage includes a link to download a file, the checksum will also be listed. This gives the downloader a way to confirm they downloaded the intended file (not a malicious modified version instead).

There are different algorithms that can be used to determine a checksum. Currently, the SHA-256 and SHA-512 are the most popular algorithm to use. Some older and less secure algorithms include SHA-1 and md5.

From the command line, we can find the checksum for a file with the following commands:

SHA-256 Checksum

shasum -a 256 <filename>

e.g.

shasum -a 256 myfile.zip

SHA-512 Checksum

shasum -a 512 <filename>

e.g.

shasum -a 512 myfile.zip

SHA-1 Checksum

shasum -a 1 <filename>
or
shasum <filename>

e.g.

shasum -a 1 myfile.zip
or
shasum myfile.zip

MD5 Checksum

md5 <filename>

e.g.

md5 myfile.zip
Sal Ferrarello
Sal Ferrarello (@salcode)
Sal is a PHP developer with a focus on the WordPress platform. He is a conference speaker with a background including Piano Player, Radio DJ, Magician/Juggler, Beach Photographer, and High School Math Teacher. Sal can be found professionally at WebDevStudios, where he works as a senior backend engineer.

Share this post:

Share on TwitterShare on FacebookShare on LinkedInShare on EmailShare on Reddit
Warning! This is a draft, not a finalized post. See full draft disclosure.

Filed Under: Computing, Dev Tips, Draft, Solution Tagged With: command line

Reader Interactions

Leave a Reply Cancel reply

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

Copyright © 2023 · Bootstrap4 Genesis on Genesis Framework · WordPress · Log in