-
-
Save izonder/04bbfd97c097782c25448ce811ca28ec to your computer and use it in GitHub Desktop.
Encrypt a password using SSHA. Use this for your `htpasswd` files.
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/sh | |
# http://wiki.nginx.org/Faq#How_do_I_generate_an_htpasswd_file_without_having_Apache_tools_installed.3F | |
#PASSWORD=$1; | |
read -p "enter password:" PASSWORD; | |
SALT="$(openssl rand -base64 3)" | |
SHA1=$(printf "$PASSWORD$SALT" | openssl dgst -binary -sha1 | sed 's#$#'"$SALT"'#' | base64); | |
printf "{SSHA}$SHA1\n" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment