commit 710ac6a9ccd47929ccab19e92a7190c28580b673 from: noodle date: Wed Jun 11 18:01:52 2025 UTC refactor commit - ee7b1572af1d62d7613cbcb7ca2ac284f3981ad9 commit + 710ac6a9ccd47929ccab19e92a7190c28580b673 blob - a768c862f223c58fd95f95890aa2ad928f55a3a6 blob + db8a394b31a7eafc335913495dccdbf57b2bee97 --- badphrase +++ badphrase @@ -1,7 +1,7 @@ #!/bin/sh # badphrase: generate passphrases or something lol # diceware example: ./badphrase -dvl /tmp/diceware.wordlist.asc -w 10 -# please use it with diceware bacause all other wordlists suck ToT +# please use with diceware bacause all other wordlists suck ToT # yay! set -e @@ -36,7 +36,6 @@ while getopts cde:hil:m:n:vw: arg; do esac done shift $((OPTIND - 1)) - # setup regex if [ "$includenames" -eq 1 ]; then re_class='.' @@ -45,9 +44,7 @@ else fi [ "$charmin" -lt 0 ] && charmin=0 [ "$charmax" -le 0 ] && charmax='' - # password generation pipeline - # extract 2nd column if we're on a diceware list awk -v diceware="$diceware" 'BEGIN { if (diceware) @@ -57,7 +54,7 @@ awk -v diceware="$diceware" 'BEGIN { } { print $rec }' "$wordlist" | # filter and shuffle the wordlist -grep -x "${re_class}\{${charmin},${charmax}\}" | sort -R | \ +grep -x "${re_class}\{${charmin},${charmax}\}" | sort -R | # test entropy against $entropymin and if that worked print first $wordnum lines { awk -v prog="${0##*/}" -v entropymin="$entropymin" -v wordnum="$wordnum" -v \ verbose="$verbose" 'NR <= wordnum { line[NR] = $0 } blob - 88d4f3e40c3d8265de72e7781506f80b6932477e blob + f6b2e9c43675bf19ff1362656d5b74b791d31645 --- dec +++ dec @@ -1,8 +1,5 @@ #!/bin/sh -# decode passwords -# make sure you've added at least one readable line to the password so you can -# confirm that the passphrase is correct, as openssl doesn't give errors -# about wrong passphrases and spits out garbled output instead +# dec: decrypt passwords set -e [ "$#" -ne 1 ] && { echo "usage: ${0##*/} passname" 1>&2; exit 1; } passfile="$HOME/.passwords/${1}.cha20" blob - e616aec75334627e851ee5c3d777d6a377f52e6c blob + 45530864b88c592e755d9db260c8fbf96b6d7f0e --- enc +++ enc @@ -1,8 +1,8 @@ #!/bin/sh -# encode a password from stdin with a passphrase -# make sure you add at least one readable line to the password so you can -# confirm that the passphrase is correct, as openssl doesn't give errors -# about wrong passphrases and spits out garbled output instead +# enc: encrypt a password from stdin with a passphrase +# add at least one readable line to the password so you can confirm that the +# output is correct when you're decrypting later, as openssl doesn't give +# errors about wrong passphrases and spits out garbled output instead set -e [ "$#" -ne 1 ] && { echo "usage: ${0##*/} passname" 1>&2; exit 1; } mkdir -pm 700 "$HOME/.passwords/" blob - 01587ccddb652367fd95a5baf3b37548d4a32517 blob + 50eb7a0b16cec9089284cbe79678d6570d2a3d1b --- encfile +++ encfile @@ -1,4 +1,4 @@ #!/bin/sh -# encade file with a passphrase +# encfile: encrypt a file with a passphrase set -e openssl enc -e -chacha20 -pbkdf2 -iter 10000 -in "$1" -out "$1.cha20" blob - 12be2d433580ce2ddcac52ad14c28e55956e0260 blob + f548759f07765b0e3872132ab00f8ea9120883b9 --- entropy +++ entropy @@ -1,8 +1,7 @@ #!/bin/sh -# entropy: calculates the entropy of a password given the password length and -# number of possiblities +# entropy: calculate the entropy of a password given it's length and number of +# possible characters set -e - num=0 [ "$1" = '-n' ] && { num=1; shift; } [ "$#" -ne 2 ] && { echo "usage: ${0##*/} [-n] possibilites length " 1>&2; exit 1; } blob - fec35b244d18df3a3fad441c9fb3e58c17ef0ed9 blob + 2307217544b5770c69251e1e4a46351e1941257b --- gen +++ gen @@ -1,10 +1,9 @@ #!/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') +# gen: generate passwordssss (:<)~~~~~ +# the range is from ascii space (32) to tilde (126) -> 126-32+1=95 +# possibilities which yeilds 256+ bits of entropy at a password length of 40 +# (can be calculated with `entropy 95 40') set -e - length=40 [ "$#" -gt 1 ] && { echo "usage: ${0##*/} [length]" 1>&2; exit 1; } [ "$#" -eq 1 ] && length=$1