Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP md5() gives different output then MySQL md5

Tags:

php

mysql

md5

I'm trying to set up a login system, but I can't solve one problem: PHP is giving me an other output with md5(); than MySQL...

For example, in PHP:

$password = md5("brickmasterj");
return $password;

Returns:

3aa7b18f304e2e2a088cfd197351cfa8

But the MySQL equivalent gives me a shorter version:

3aa7b18f304e2e2a08

What's the problem? And how do I work with this while checking passwords?

like image 605
Jers Avatar asked Jul 18 '12 11:07

Jers


1 Answers

I guess the problem in the length of column of your table, set the length of password field to at least 32

like image 94
haynar Avatar answered Sep 30 '22 06:09

haynar