Add base32 and 64 password support to genpass

This commit is contained in:
Pavle Portic 2021-06-28 23:46:02 +02:00
parent 6de2d3375c
commit 93f35b3358
Signed by: TheEdgeOfRage
GPG Key ID: F2AB38285780DE3D
1 changed files with 10 additions and 8 deletions

View File

@ -14,6 +14,8 @@ Generate random password from /dev/urandom using the character set chosen
Option (pick one character set):"
local help_options="\t\-a ,\--all\ all printable characters, not including space
\t\-lt ,\--limited\ all except special characters [A-Za-z0-9%+,-./:=@^_]
\t\-b32 ,\--base32\ all valid base32 characters [A-Z2-7=]
\t\-b64 ,\--base64\ all valid base64 characters [A-Za-z0-9+/]
\t\-an ,\--alphanumeric\ letters and digits
\t\-al ,\--alpha\ letters
\t\-u ,\--upper\ upper case letters
@ -55,42 +57,42 @@ key="$1"
case $key in
-a|--all)
all="true"
characters="[:graph:]"
shift
;;
-lt|--limited)
special="true"
characters="A-Za-z0-9%+,-./:=@^_"
shift
;;
-b32|--base32)
characters="A-Z2-7="
shift
;;
-b64|--base64)
characters="A-Za-z0-9+/"
shift
;;
-an|--alphanumeric)
alphanumeric="true"
characters="[:alnum:]"
shift
;;
-al|--alpha)
alpha="true"
characters="[:alpha:]"
shift
;;
-u|--upper)
upper="true"
characters="[:upper:]"
shift
;;
-l|--lower)
lower="true"
characters="[:lower:]"
shift
;;
-n|--numeric)
numeric="true"
characters="[:digit:]"
shift
;;
-h|--hex)
hex="true"
characters="0-9a-f"
shift
;;