I have a form which is storing an md5
'ed password.
For testing purposes I am using " 12345 " as a password.
To save the password I use: $password = md5($password);
Using the same code and the same password the PHP is creating a different md5
hash everytime although I'm using the same password each time.
Any ideas why this might be happening?
That's not possible with md5()
, The hash will never change for a given text , It's definitely wrong with your implementation.
Maybe you are passing the md5()
hashed password as an argument to the md5()
function again and again.
There maybe some whitespace getting added to your $password
. Just trim()
it as shown below.
$password = md5(trim($password));
Remember : Even a space can change your hash.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.