Add base32 and 64 password support to genpass
This commit is contained in:
parent
6de2d3375c
commit
93f35b3358
|
@ -14,6 +14,8 @@ Generate random password from /dev/urandom using the character set chosen
|
||||||
Option (pick one character set):"
|
Option (pick one character set):"
|
||||||
local help_options="\t\-a ,\--all\ all printable characters, not including space
|
local help_options="\t\-a ,\--all\ all printable characters, not including space
|
||||||
\t\-lt ,\--limited\ all except special characters [A-Za-z0-9%+,-./:=@^_]
|
\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\-an ,\--alphanumeric\ letters and digits
|
||||||
\t\-al ,\--alpha\ letters
|
\t\-al ,\--alpha\ letters
|
||||||
\t\-u ,\--upper\ upper case letters
|
\t\-u ,\--upper\ upper case letters
|
||||||
|
@ -55,42 +57,42 @@ key="$1"
|
||||||
|
|
||||||
case $key in
|
case $key in
|
||||||
-a|--all)
|
-a|--all)
|
||||||
all="true"
|
|
||||||
characters="[:graph:]"
|
characters="[:graph:]"
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
-lt|--limited)
|
-lt|--limited)
|
||||||
special="true"
|
|
||||||
characters="A-Za-z0-9%+,-./:=@^_"
|
characters="A-Za-z0-9%+,-./:=@^_"
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
|
-b32|--base32)
|
||||||
|
characters="A-Z2-7="
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-b64|--base64)
|
||||||
|
characters="A-Za-z0-9+/"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
-an|--alphanumeric)
|
-an|--alphanumeric)
|
||||||
alphanumeric="true"
|
|
||||||
characters="[:alnum:]"
|
characters="[:alnum:]"
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
-al|--alpha)
|
-al|--alpha)
|
||||||
alpha="true"
|
|
||||||
characters="[:alpha:]"
|
characters="[:alpha:]"
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
-u|--upper)
|
-u|--upper)
|
||||||
upper="true"
|
|
||||||
characters="[:upper:]"
|
characters="[:upper:]"
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
-l|--lower)
|
-l|--lower)
|
||||||
lower="true"
|
|
||||||
characters="[:lower:]"
|
characters="[:lower:]"
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
-n|--numeric)
|
-n|--numeric)
|
||||||
numeric="true"
|
|
||||||
characters="[:digit:]"
|
characters="[:digit:]"
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
-h|--hex)
|
-h|--hex)
|
||||||
hex="true"
|
|
||||||
characters="0-9a-f"
|
characters="0-9a-f"
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
|
|
Loading…
Reference in New Issue