Created
November 6, 2023 14:39
-
-
Save hbro/00b91721f7a39f835d9e78f7c254dea0 to your computer and use it in GitHub Desktop.
Random Passphrase Generator
This file contains 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
#!/usr/bin/env bash | |
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) | |
amount=${1:-1} | |
# curl -s 'https://raw.githubusercontent.com/first20hours/google-10000-english/master/google-10000-english-no-swears.txt' | awk 'length($0) > 6 && length($0) < 12' > passphrase-words.txt | |
source='passphrase-words.txt' | |
for n in $(seq 1 $amount); do | |
pw='' | |
for i in {1..3}; do | |
word=$(shuf -n 1 "${SCRIPT_DIR}/${source}" | sed -e "s/\b\(.\)/\u\1/g") | |
pw="${pw}${word}-" | |
done | |
no=$(($RANDOM % 100)) | |
pw="${pw}${no}" | |
echo "$pw" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment