Available since PHP 5.5 password_hash is a really simple and strong way to encrypt passwords.
This is a one way encryption which means you cannot discover the original password relying on the encrypted hash.
Usage:
1 2 3 4 5 6 |
$password = $_POST['password']; $hashed_password = password_hash($password, PASSWORD_DEFAULT); if(password_verify($password_another_session, $hashed_password)) { // If the password inputs matched the hashed password in the database // Do something, you know... log them in. } |