Password generator: Difference between revisions
Content added Content deleted
(Ada version) |
Drkameleon (talk | contribs) (Added Arturo implementation) |
||
Line 519: | Line 519: | ||
6%K6(8&fyX=,&TBFvW%kz3 |
6%K6(8&fyX=,&TBFvW%kz3 |
||
+@pyJ'3YQ'%~9?Tm/BHk?A</pre> |
+@pyJ'3YQ'%~9?Tm/BHk?A</pre> |
||
=={{header|Arturo}}== |
|||
<lang rebol>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 |
|||
]</lang> |
|||
{{out}} |
|||
<pre>; execute with ./passgen.art 10 |
|||
T{6G7:qgyp |
|||
s7|iC2S0Tf |
|||
D6.Ac}1}oz |
|||
9**;81R@h< |
|||
H+|0CBN(ca |
|||
x!C#0yri]@ |
|||
OfV7wlg*<G |
|||
{0z3MVJUNg |
|||
yULk,=B)84 |
|||
C>o6]&9y<X</pre> |
|||
=={{header|AWK}}== |
=={{header|AWK}}== |