scripts: add bcrypt script
This commit is contained in:
parent
7a95706af2
commit
99d57ba005
3 changed files with 19 additions and 0 deletions
17
scripts/bcrypt
Executable file
17
scripts/bcrypt
Executable file
|
@ -0,0 +1,17 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
if [ "$#" = 0 ]; then
|
||||
echo "Usage: $0 [passwords...] | $0 - < passwords.txt" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$1" = '-' ]; then
|
||||
xargs -x -n1 -d'\n' htpasswd -bnBC 10 "" | tr -d ':' | sed '/^$/d'
|
||||
else
|
||||
for pass in "$@"; do
|
||||
htpasswd -bnBC 10 "" "$pass" | tr -d ':' | sed '/^$/d'
|
||||
done
|
||||
fi
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue