commit adb397d0e38e75d9485b8068e247a133534c0108 parent 7031709658b05ece4b9c1ae10e12fc64b42f24c3 Author: boredpasta <boredpasta@tutanota.com> Date: Thu, 5 Jun 2025 17:37:35 +0300 gen, entropy: amend description and add set -e Diffstat:
M | entropy | | | 5 | +++-- |
M | gen | | | 5 | +++++ |
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/entropy b/entropy @@ -1,6 +1,7 @@ #!/bin/sh -# entropy: calculates the entropy of a password given the length and number of -# possiblities +# entropy: calculates the entropy of a password given the password length and +# number of possiblities +set -e num=0 [ "$1" = '-n' ] && { num=1; shift; } diff --git a/gen b/gen @@ -1,5 +1,10 @@ #!/bin/sh # generate passwordssss +# range is from ascii space (32) to tilde (126) -> 126-32=96 possibilities +# which yeilds 256+ bits of entropy at a password length of 40 (can be +# calculatedwith `entropy 96 40') +set -e + length=40 [ "$#" -gt 1 ] && { echo "usage: ${0##*/} [length]" 1>&2; exit 1; } [ "$#" -eq 1 ] && length=$1