35 lines
771 B
Text
35 lines
771 B
Text
lowercase: `a`..`z`
|
|
uppercase: `A`..`Z`
|
|
digits: `0`..`9`
|
|
other: map split "!\"#$%&'()*+,-./:;<=>?@[]^_{|}~" => [to :char]
|
|
|
|
any: lowercase ++ uppercase ++ digits ++ other
|
|
|
|
generate: function [length][
|
|
if length < 4 [
|
|
print (color #red "ERROR: ") ++ "password length too short"
|
|
exit
|
|
]
|
|
|
|
chars: new @[sample lowercase sample uppercase sample digits sample other]
|
|
while [length > size chars][
|
|
'chars ++ sample any
|
|
]
|
|
|
|
join shuffle chars
|
|
]
|
|
|
|
if 0 = size arg [
|
|
print {
|
|
---------------------------------
|
|
Arturo password generator
|
|
(c) 2021 drkameleon
|
|
---------------------------------
|
|
usage: passgen.art <length>
|
|
}
|
|
exit
|
|
]
|
|
|
|
loop 1..10 'x [
|
|
print generate to :integer first arg
|
|
]
|