Skip to content

Instantly share code, notes, and snippets.

@hoangdh
Created February 11, 2019 04:47
Show Gist options
  • Save hoangdh/97ce997d089e7faf69e7151f92f7cac6 to your computer and use it in GitHub Desktop.
Save hoangdh/97ce997d089e7faf69e7151f92f7cac6 to your computer and use it in GitHub Desktop.
How to get the MD5 hash of a string directly in the terminal
#!/bin/bash
encrypt(){
echo -n "$1" | md5sum | awk {'print $1'}
# echo -n "$1" | openssl md5 | awk {'print $2'}
}
RAW="$1"
encrypt $RAW
# Ref: https://askubuntu.com/questions/53846/how-to-get-the-md5-hash-of-a-string-directly-in-the-terminal
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment