I am running into a problem in my implementation of your recommendation.
Let’s say that my password table has two fields, “Username” and “Pass”, where the “Pass” field is defined to be VARCHAR(255).
To create his account, the user, say, has entered “abc” as the password, and that is stored in $given_pswd. I then compute a hashed password with the command:
$pswd = password_hash($given_pswd, PASSWORD_DEFAULT);
and I insert the password into the database table with the SQL query:
INSERT INTO password_table VALUES (“Username”, ‘$pswd’);
When that user now tries to log in and enters “abc” as the password, I go to the database to check its validity. But first I compute the hashed value of “abc” with
$pswd = password_hash($provided_pswd, PASSWORD_DEFAULT);
where $provided_pswd is “abc”.
What is happening is that the two password entries are different!! That is, when I created the hashed password with
$pswd = password_hash("abc", PASSWORD_DEFAULT);
and when I compute it again with
$pswd = password_hash("abc", PASSWORD_DEFAULT);
I get a different value for the hashed password. In fact, every time I get a hashed value for the very same input, I get a different result.
I don’t see that using a different option in the second field is possible.
What am I doing wrong?
Thanks again.
Len Jacobson