I am trying to set up a secure login & register system using crypt() as I have read that that is php's stored function for bcrypt
I am registering a user but taking their password and and then crypting it.
$hashed_password = crypt($mypassword);
I then store $hashed_password in the db
then when the user logs in I am trying to match the password to whats stored.
I found this function on php.net but cant get it to work
$password is the stored crypted password and $mypassword is the users input
if ($password == crypt($mypassword, $password)) {
echo "Success! Valid password";
}
I understand that crypt generates a unique hash each time its called so I dont understand how the function can work.
Am I completeley missing the point as I read that crypt() is a one function and decrypt does not exist?
any help greatly appreciated in not only showing the error of my ways but also in completing this secure login