DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

Teerasak Vichadee
Teerasak Vichadee

Posted on

Generate SHA256 Hash on OSX Command Line

Just run echo -n any string | shasum -a 256 | awk '{ print $1 }'

Fin.

Note

  • AWK are not acronym of awkward but it's acronym of the family names of its authors (Alfred Aho, Peter Weinberger, and Brian Kernighan)
  • Added -n to echo to prevent new line so that we will get the right SHA256 from our input string without newline 😺 (suggestion from @fallenpixel)

Top comments (1)

Collapse
 
fallenpixel profile image
Eric Lehmann

Just something to be aware of. echo will include a terminal new line character at the end of your string without the -n flag.

We are hiring! Do you want to be our Senior Platform Engineer? Are you capable of chipping in across sysadmin, ops, and site reliability work, while supporting the open source stack that runs DEV and other communities?

This role might just be for you!

Apply now