Try to fix the password generation functions hanging

This commit is contained in:
Matthew Lopez 2023-12-26 19:19:42 -05:00
parent c37fdfa8aa
commit d877efc842
No known key found for this signature in database
GPG Key ID: 302A6EE3D63B7E0E

View File

@ -4,12 +4,12 @@ set -eu
generate_password() {
length=$1
tr -dc "a-zA-Z0-9" </dev/urandom | fold -w "$length" | head -n 1
head /dev/urandom | tr -dc "a-zA-Z0-9" | head -c "$length"
}
generate_hex() {
length=$1
tr -dc "A-F0-9" </dev/urandom | fold -w "$length" | head -n 1
head /dev/urandom | tr -dc "a-zA-Z0-9" | head -c "$length"
}
# Validate arguments