programming-examples/perl/String/Check password.pl

19 lines
305 B
Perl
Raw Normal View History

2019-11-15 12:59:38 +01:00
$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: ";
}
}