This commit is contained in:
Yanick Champoux 2017-12-05 12:47:11 -05:00
parent daadd18fa2
commit 1e20c2a640
2 changed files with 39 additions and 0 deletions

19
2015/11/1.pl Normal file
View File

@ -0,0 +1,19 @@
use 5.20.0;
use experimental 'signatures';
my $alpha = join '', 'a'..'z';
my $seq = join '|', map { substr $alpha, $_, 3 } 0..length($alpha)-3;
$seq = qr/$seq/;
my $password = <>;
chomp($password);
1 until is_valid(++$password);
say $password;
sub is_valid($p) {
return 0 if $p =~ /[iol]/;
return 0 unless $p =~ /(.)\1.*?(.)\2/;
return $p =~ $seq;
}

20
2015/11/2.pl Normal file
View File

@ -0,0 +1,20 @@
use 5.20.0;
use experimental 'signatures';
my $alpha = join '', 'a'..'z';
my $seq = join '|', map { substr $alpha, $_, 3 } 0..length($alpha)-3;
$seq = qr/$seq/;
my $password = <>;
chomp($password);
1 until is_valid(++$password);
1 until is_valid(++$password);
say $password;
sub is_valid($p) {
return 0 if $p =~ /[iol]/;
return 0 unless $p =~ /(.)\1.*?(.)\2/;
return $p =~ $seq;
}