programming-examples/perl/String/The crypt function encrypts a string using the NBS Data Encryption Standard (DES) algorithm.pl
2019-11-15 12:59:38 +01:00

16 lines
358 B
Perl

#!/usr/local/bin/perl
open (PASSWD, "/u/jqpublic/passwd") || die ("Can't open password file");
$passwd = <PASSWD>;
chop ($passwd);
close (PASSWD);
$mypasswd = "asdf";
if (crypt ($mypasswd, substr($passwd, 0, 2)) eq $passwd) {
print ("Correct! Carry on!\n");
} else {
die ("Incorrect password: goodbye!\n");
}