


<?php

// The plain text password to be hashed
$plaintext_password = "david123";

// The hash of the password that
// can be stored in the database
$hash = password_hash($plaintext_password,
		PASSWORD_DEFAULT);

// Print the generated hash
echo "Generated hash: ".$hash;
echo "<br />";


  // Plaintext password entered by the user
  $plaintext_password = "david123";

  // The hashed password retrieved from database
  $hash =
"$2y$10$Hrume15b5yY7kv7bjs1Myu6EcHNXz6yTyWABBHyFy1FJ/ZXJBqaMO";

  // Verify the hash against the password entered
  $verify = password_verify($plaintext_password, $hash);

  // Print the result depending if they match
  if ($verify) {
      echo 'Password Verified!';
  } else {
      echo 'Incorrect Password!';
  }
?>
