mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-01-22 01:07:36 +08:00
Compare commits
No commits in common. "f2a4b2b17bbf9103dd90d23a73163e9b4e0e47f1" and "2a0ae3315db98d137de547e2cb9adfbc38263e6c" have entirely different histories.
f2a4b2b17b
...
2a0ae3315d
@ -73,19 +73,8 @@ genpass-monkey() {
|
|||||||
|
|
||||||
genpass-xkcd() {
|
genpass-xkcd() {
|
||||||
# Generates a 128-bit XKCD-style passphrase
|
# Generates a 128-bit XKCD-style passphrase
|
||||||
# e.g, 9-mien-flood-Patti-buxom-dozes-ickier-pay-ailed-Foster
|
# EG, 9-mien-flood-Patti-buxom-dozes-ickier-pay-ailed-Foster
|
||||||
# Can take a numerical argument for generating extra passwords
|
# Can take a numerical argument for generating extra passwords
|
||||||
|
|
||||||
if (( ! $+commands[shuf] )); then
|
|
||||||
echo >&2 "$0: \`shuf\` command not found. Install coreutils (\`brew install coreutils\` on macOS)."
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ ! -e /usr/share/dict/words ]]; then
|
|
||||||
echo >&2 "$0: no wordlist found in \`/usr/share/dict/words\`. Install one first."
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
local -i i num
|
local -i i num
|
||||||
|
|
||||||
[[ $1 =~ '^[0-9]+$' ]] && num=$1 || num=1
|
[[ $1 =~ '^[0-9]+$' ]] && num=$1 || num=1
|
||||||
@ -101,6 +90,6 @@ genpass-xkcd() {
|
|||||||
|
|
||||||
for i in {1..$num}; do
|
for i in {1..$num}; do
|
||||||
printf "$n-"
|
printf "$n-"
|
||||||
printf "$dict" | shuf -n "$n" | paste -sd '-' -
|
printf "$dict" | shuf -n "$n" | paste -sd '-'
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user