tRemove one xargs call to speed things up - hashcrush - Compute Argon2id hashes
 (HTM) git clone git://git.z3bra.org/hashcrush.git
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
       ---
 (DIR) commit 5e9f60ac3b02cbadb5ac4ad993af32710859e0c4
 (DIR) parent 2ad2869fd06f97840cbb22c8dd211b36c3650d69
 (HTM) Author: Willy Goiffon <contact@z3bra.org>
       Date:   Fri, 18 Aug 2023 11:27:00 +0200
       
       Remove one xargs call to speed things up
       
       Diffstat:
         M makefile                            |       2 +-
         M tools/diceware                      |       9 ++++-----
       
       2 files changed, 5 insertions(+), 6 deletions(-)
       ---
 (DIR) diff --git a/makefile b/makefile
       t@@ -13,7 +13,7 @@ ${OUTFILE}:
                make -j${NPROC} $(CPU:%=%.rec) > $@
        
        $(CPU:%=%.rec): ${DICT} tools/hashgen
       -        ./tools/diceware -c ${WORDCOUNT} -f ${DICT} 2>/dev/null | ./tools/hashdump | grep --line-buffered -Fm $$((${COUNT}/${NPROC})) + > $@
       +        ./tools/diceware -c ${WORDCOUNT} -f ${DICT} 2>/dev/null | ./tools/hashdump | head -n $$((${COUNT}/${NPROC})) > $@
                
        tools/hashgen:
                make -C hashgen
 (DIR) diff --git a/tools/diceware b/tools/diceware
       t@@ -20,8 +20,7 @@ done
        [ ! -e "${dict}" ] && { printf '%s: file not found\n' "$dict"                  >&2; exit 1; }
        
        tr -cd 1-6 </dev/urandom \
       -        | fold -w 5                   \
       -        | xargs -I% grep -Fm1 % $dict \
       -        | cut -f2                     \
       -        | xargs -n5 echo              \
       -        | awk '!(NR%3){print $0;}(NR%3==1){print toupper(substr($0,1,1))substr($0,2);} (NR%3==2){print toupper($0);}'
       +        | 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