PHP and MySQL different SHA1/MD5?

Hey, Im boggled now!

I am getting different passwords for the same string “jboy”.

I run this in MySQL, and it stores the output in the database:

UPDATE users SET password = MD5(password)

Outputs: 50592fd0a0d832ff75b62ff518a1f4d2

I echo this after typing in “jboy” in a field

echo $this->password = md5($password);

Outputs: 924ca8093c1d686802d2fdec66463fe8

They don’t match up, is there something I don’t know about here?

Are you sure there isn’t any whitespace, newlines or anything of the sort that might be interfering? Use trim().

It seems to be the PHP one that’s the problem. This online generator clearly uses PHP and it outputs the same as what your MySQL is producing. So the problem must lie with whatever you’re passing to to PHP’s md5().

Thanks I will test this some more good to know where its coming from :slight_smile:

Hey you are right, it had to do with trim. Thanks dude :smiley: