
yapp
User
Feb 23, 2002, 2:16 AM
Post #3 of 3
(47062 views)
|
Yep. Here are even some more details (using a sample console program) [perl] print "Please enter your password: "; chomp(my $password) = <STDIN>; # Enter a password my $crypted = crypt($password, 'rx'); # rx is just a random key. print "crypted password: $crypted\n"; ## Now, append this code to see a password check in action: print "\nNow, let's check passwords\nPlease enter your password: "; chomp(my $entered = <STDIN>); if( crypt($entered, $crypted) eq $crypted) { print "Password is OK\n"; } else { print "Wrong password!\n"; } [/perl] Does this forum only accept one perl code tag?? I couldn't split these two? Yet Another Perl Programmer _________________________________ ~~> [url=http://www.codingdomain.com]www.codingdomain.com <~~ More then 3500 X-Forum [url=http://www.codingdomain.com/cgi-perl/downloads/x-forum]Downloads!
(This post was edited by yapp on Feb 23, 2002, 2:19 AM)
|