PHP

PHP Password Encryption and Decryption

In this page, it includes the PHP source code and the display of
'How to Encrypt or Decrypt a String in PHP through password_hash'.

Encryption

Input
password_hash("KosonTechnology", PASSWORD_DEFAULT);
Output
$2y$10$vUAas4YFVnSvcJ/ImQNXB.437U7r5wvxy72kSCtWjxXf3VjM2B42C


Decryption

$unencrypted_password = "KosonTechnology";
$hash= "$2y$10$vUAas4YFVnSvcJ/ImQNXB.437U7r5wvxy72kSCtWjxXf3VjM2B42C";
$verify = password_verify($unencrypted_password, $hash);

if ($verify) {
echo 'Correct Password!';
}
else {
echo 'Password is Incorrect';
}