tImprove overall perfs thorough the makefile - hashcrush - Compute Argon2id hashes
 (HTM) git clone git://git.z3bra.org/hashcrush.git
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
       ---
 (DIR) commit d9cbc1377c55473a1dae9aa1150567bca354b11f
 (DIR) parent 5e9f60ac3b02cbadb5ac4ad993af32710859e0c4
 (HTM) Author: Willy Goiffon <contact@z3bra.org>
       Date:   Fri, 18 Aug 2023 12:00:06 +0200
       
       Improve overall perfs thorough the makefile
       
       Diffstat:
         M makefile                            |       9 +++++++--
         M tools/diceware                      |      13 ++++++++-----
       
       2 files changed, 15 insertions(+), 7 deletions(-)
       ---
 (DIR) diff --git a/makefile b/makefile
       t@@ -9,11 +9,16 @@ CPU      != for n in ${SEQ}; do printf '.cpu%02d\n' $$n; done
        all: ${OUTFILE}
        
        ${OUTFILE}:
       -        trap 'cat $(CPU:%=%.rec) > $@' EXIT TERM INT; \
       +        @printf 'HASHDUMP > %s\n' $(CPU:%=%.rec)
       +        @trap 'cat $(CPU:%=%.rec) > $@' EXIT TERM INT; \
                make -j${NPROC} $(CPU:%=%.rec) > $@
       +        @printf 'cat %s > %s\n' "$(CPU:%=%.rec)" "$@"
        
        $(CPU:%=%.rec): ${DICT} tools/hashgen
       -        ./tools/diceware -c ${WORDCOUNT} -f ${DICT} 2>/dev/null | ./tools/hashdump | head -n $$((${COUNT}/${NPROC})) > $@
       +        while :; do ./tools/diceware -c ${WORDCOUNT} -f ${DICT} || exit; done \
       +                | head -n $$((${COUNT}/${NPROC})) \
       +                | awk '(NR%2){print toupper(substr($$0,1,1))substr($$0,2);} !(NR%2){print toupper($$0);}' \
       +                | ./tools/hashdump > $@
                
        tools/hashgen:
                make -C hashgen
 (DIR) diff --git a/tools/diceware b/tools/diceware
       t@@ -6,6 +6,13 @@ usage() {
                echo "usage: $(basename $0) -f wordlist [-c count]"
        }
        
       +roll() {
       +        r=$(tr -cd 1-6 </dev/urandom \
       +                | fold -w 5 \
       +                | head -n 1)
       +        grep -Fm1 "$r" "$dict" | cut -f2
       +}
       +
        count=5
        while getopts 'c:f:h' OPT; do
                case $OPT in
       t@@ -19,8 +26,4 @@ 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; }
        
       -tr -cd 1-6 </dev/urandom \
       -        | fold -w 5 \
       -        | while read roll; do grep -F1 $roll $dict | cut -f2 || exit; done \
       -        | xargs -n${count} echo 2>/dev/null \
       -        | awk '(NR%2){print toupper(substr($0,1,1))substr($0,2);} !(NR%2){print toupper($0);}' 2>/dev/null
       +echo $(for i in $(seq $count); do roll; done)