I really want to port my code to the new password_ * functions provided initially by PHP.
Existing hashes in the database were generated as follows:
hash ('sha512', '<A constant defined earlier>' . $email . $password);
I would like to move them to the hashes currently created:
password_hash ($password, PASSWORD_DEFAULT);
Obviously, when the user logs in, I can take the opportunity to create a new hash from the password just provided and save it in the database.
However, I would like for me not to have two fields in the database, namely for an obsolete hash and one for a modern password. Instead, I would rather replace the old ones as each user logs in.
Therefore, you can save one database field, and userland code determine whether the hash is old , i.e. determine which check to use?
(I assume that hash hashes ('sha512') cannot be automatically updated to crypt ()?)
source
share