programming-examples/perl/String/Check password.pl
2019-11-15 12:59:38 +01:00

19 lines
305 B
Perl

$encrypted = "AB/uOsC7P93EI";
$salt = substr($encrypted, 0, 2);
print "Guess the word: ";
while(<>) {
chomp;
if ($encrypted eq (crypt $_, $salt)) {
print "You got it!";
exit;
} else {
print "Nope.\n";
print "Guess the word: ";
}
}