Skip to content

Instantly share code, notes, and snippets.

@sandheepg
Last active March 8, 2017 05:15
Show Gist options
  • Select an option

  • Save sandheepg/ec9dfceec0f8d3a6dd64e082629d924c to your computer and use it in GitHub Desktop.

Select an option

Save sandheepg/ec9dfceec0f8d3a6dd64e082629d924c to your computer and use it in GitHub Desktop.
Generate Hashed password

To generate SHA-1 cryptographic hash of a password text

echo -n "some password" | openssl sha1
# for mac
echo -n "some password" | shasum -a 1 | awk '{print $1}’ # SHA1 hash
echo -n "some password" | shasum -a 256 | awk '{print $1}’ # SHA256 hash
# for linux
echo -n "some password" | sha1sum | awk '{print $1}’ # SHA1 hash
echo -n "some password" | sha1sum | awk '{print toupper($1)}' # for upcase
echo -n "some password" | sha256sum | awk '{print $1}' # SHA 256 hash

To generate a md5 hash

md5 -s “some password”
# OR
echo -n “some password” | md5
# OR
echo -n "some password" | md5sum | awk '{print $1}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment