I use the following subroutine to encrypt a password, then another to store it in a database. I have not been able to figure out how to handle the login process for the user. i.e. the user places username and password in a form and submits. How can my perl script check the password for validity?
my $str= shift @_;
my @salt_chars = ('a'..'z','A'..'Z','0'..'9');
my $salt = $salt_chars[rand(63)] . $salt_chars[rand(63)];
return crypt($str, $salt);