-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpassword_generator
executable file
·51 lines (38 loc) · 1.04 KB
/
password_generator
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/usr/bin/env perl
# Generate an easy-to-use password
# See also https://www.komando.com/security-privacy/check-your-password-strength/783192/
# Also consider `pwgen -1ABnsr oiOI0lL1`
# SETUP
use strict;
use warnings;
my $debug = 0;
my @vowel = (qw/ a e i o u /); print '@vowel = ' .join(', ',@vowel) ."\n" if $debug;
my @not_vowel = (qw/ q w r t y p s d f g h k z x c v b n m /); print '@not_vowel = '.join(', ',@not_vowel)."\n" if $debug;
my @numba = (qw/ 2 3 4 5 6 7 8 9 /); print '@numba = ' .join(', ',@numba) ."\n" if $debug;
# MAIN
my @password = (
uc(con()),
vow(),
vow(),
con(),
con(),
num(),
num(),
con(),
vow(),
vow(),
con(),
con(),
);
print join('',@password)."\n";
exit;
# FUNCTIONS
sub vow { _choose(\@vowel) }
sub con { _choose(\@not_vowel) }
sub num { _choose(\@numba) }
sub _choose {
my ($list) = (@_);
my $choice = $list->[ rand @$list ];
print "choice = $choice\n" if $debug;
return $choice;
}