Gossamer Forum
Home : General : Internet Technologies :

md5() function

Quote Reply
md5() function
I've been using md5() to "encrypt" my password's so that when they are displayed in the address bar they are not readable, however, I'm having a problem.

When I use this function on my password,
$login_pword = md5($login_pword[FALSE]);

Everything appears to be working normally and fine. But after this long string created from md5() is added to the database and I run my pword verification code, it seems that whenever the pword's first character or any first characters are tested, they all pass.

code eg.

Code:


$pword = "joshua ";
$chk_pword = md5($pword[FALSE]);

$grabbedpword = "54kl3j4a40c043kois3"; // Taken from Database.



if($chk_pword != $grabbedpword) {
echo("Verification Failed!");
} else {
echo("Verification Passed!");
}


So for this code, let's assume that long string actually was the md5() for "joshua". Now anytime "j", "jo", "jos", etc. are tested in the $pword var. it still passes verification.

Can anyone tell me why? Is the md5() function only for the first char in a string? From reading the documentation I was under the impression that it wasn't but I very well could be wrong.

Last edited by:

JoFrRi: Nov 5, 2003, 2:09 PM
Quote Reply
Re: [JoFrRi] md5() function In reply to
Change:

$pword[FALSE]

to:

$pword



----
Cheers,

Dan
Founder and CEO

LionsGate Creative
GoodPassRobot
Magelln
Quote Reply
Re: [dan] md5() function In reply to
Awesome, problem solved. Thanks a ton.