Ask Sawal Facebook Login

By logging in, you are agreeing to our privacy policy and terms of services.

#Question# Md5 encrypted password in the database is not matching with user provided md5 encrypted password?


User provided password is stored MD5 encrypted format in the database. If user provides same password which is converted into MD5 string is not matching with the stored encrypted password. 

Please guide me with a solution. Thanks

Upload Image

To submit answer, Please login!


Total Number of Answers Available: 1

  • Profession: Editor, Writer, Blogger, SEO Expert
    seo digital marketing video editing screenwriting blogging



I am not sure what exactly causing this error. 

I have also gone through this situation. I am explaining how I solved this. 


While creating table, I have set maximum string length of password field in the database table to 12 as I was allowing only 12 character password to store in the database. 

But when we encrypt a string with md5, the string length changes. 

<?php $str="Banana"; echo md5($str);
output: 72b302bf297a228a75730123efef7c41

See the md5 format of string value Banana has larger string length. By default, my maximum password field length was set to 12, so it trimmed rest of the string. 

See if you have same issue. All you need to do is increase password field maximum length. 

Liked My Answer! Hit Good Answer Button Below.

Total Good Ratings:47
Good Answer
Poor Answer