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$a.fqb3Xsgh9SjnPRQD8Nt.SVIUTTW41Z78T0Wfn.IM0fhu9HgrqCW


Decryption

$unencrypted_password = "KosonTechnology";
$hash= "$2y$10$a.fqb3Xsgh9SjnPRQD8Nt.SVIUTTW41Z78T0Wfn.IM0fhu9HgrqCW";
$verify = password_verify($unencrypted_password, $hash);

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