The crypt function encrypts a string using the NBS Data Encryption Standard (DES) algorithm. : crypt « String « Perl






The crypt function encrypts a string using the NBS Data Encryption Standard (DES) algorithm.

      

#!/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"); 
} 

   
    
    
    
    
    
  








Related examples in the same category

1.crypt a string
2.Use the crypt() operator to store passwords in an unbreakable format