Generate SHA256 Hash on OSX Command Line
Lumin

Lumin @ilumin

Location:
Bangkok, Thailand
Joined:
Jan 25, 2018

Generate SHA256 Hash on OSX Command Line

Publish Date: Feb 9 '22
14 1

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)

Comments 1 total

  • Eric Lehmann
    Eric LehmannFeb 9, 2022

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

Add comment