Created
February 11, 2019 04:47
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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