tRestore original diceware which was the fastest - hashcrush - Compute Argon2id hashes
(HTM) git clone git://git.z3bra.org/hashcrush.git
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
---
(DIR) commit 9306dee37189be6b0f68afab7b1c9e6972298a4d
(DIR) parent d9cbc1377c55473a1dae9aa1150567bca354b11f
(HTM) Author: Willy Goiffon <contact@z3bra.org>
Date: Fri, 18 Aug 2023 12:03:27 +0200
Restore original diceware which was the fastest
Diffstat:
M tools/diceware | 14 +++++---------
1 file changed, 5 insertions(+), 9 deletions(-)
---
(DIR) diff --git a/tools/diceware b/tools/diceware
t@@ -1,16 +1,15 @@
#!/bin/sh
-set -o noglob
-
usage() {
echo "usage: $(basename $0) -f wordlist [-c count]"
}
roll() {
- r=$(tr -cd 1-6 </dev/urandom \
+ tr -cd 1-6 </dev/urandom \
| fold -w 5 \
- | head -n 1)
- grep -Fm1 "$r" "$dict" | cut -f2
+ | head -n ${count} \
+ | tr '\n' '|' \
+ | sed 's,|$,,'
}
count=5
t@@ -23,7 +22,4 @@ while getopts 'c:f:h' OPT; do
esac
done
-[ -z "${dict}" ] && { printf '%s: no word list specified\n' "$(basename $0)" >&2; exit 1; }
-[ ! -e "${dict}" ] && { printf '%s: file not found\n' "$dict" >&2; exit 1; }
-
-echo $(for i in $(seq $count); do roll; done)
+echo $(grep -E "^($(roll ${count}))" $dict | cut -f2)