Gossamer Forum
Home : General : Perl Programming :

MD5 digest problem

Quote Reply
MD5 digest problem
hey i have two scripts that compare a password on a database. one creates the password when a member registers that other attempts to log them in. for security i have decided to use Digest MD5, so the password can't be read in plain txt. the problem is that the two password dont match. i was wondering if anyone had any ideas?
thanks
Pedge




Code:
#Code for Register.pl

use Digest::MD5 qw(md5 md5_hex md5_base64);
$digest = md5_base64($register_password);


Code:
#Code for Login.pl
use Digest::MD5 qw(md5 md5_hex md5_base64);
$statement = "select * from member where member_username='$member_username'";
@row_ary = $dbh->selectrow_array($statement);
$digest = md5_base64(@row_ary[4]);
if ($member_password eq $digest)
{
$msg = "<meta http-equiv='refresh' CONTENT='0 ;URL=home.pl'>";
}
else
{
$msg = "password doesnt match";
}

Quote Reply
Re: [pedge] MD5 digest problem In reply to
Well firstly @row_ary[4] should be $row_ary[4]

Have you checked the values of the two variables you are comparing?....what are the values?

Last edited by:

Paul: Dec 5, 2002, 9:30 AM
Quote Reply
Re: [Paul] MD5 digest problem In reply to
$digest - luLeL0jq67fBwcjnoVEXsA
$row_ary[4] - j5Iw0djROZOy5LnBBKT4Bg
Quote Reply
Re: [pedge] MD5 digest problem In reply to
But you are comparing $member_password and $digest?

Last edited by:

Paul: Dec 5, 2002, 10:24 AM
Quote Reply
Re: [Paul] MD5 digest problem In reply to
hmmm...yeah, sorry type o.
Quote Reply
Re: [pedge] MD5 digest problem In reply to
It seems to be ok for me....

http://213.106.15.160/cgi-bin/test.cgi