Skip to content

Instantly share code, notes, and snippets.

@ErMandeep
Created November 16, 2018 04:40
Show Gist options
  • Save ErMandeep/6964801c3e6951d4fee53da231910561 to your computer and use it in GitHub Desktop.
Save ErMandeep/6964801c3e6951d4fee53da231910561 to your computer and use it in GitHub Desktop.
<?php
/**
* In this case, we want to increase the default cost for BCRYPT to 12.
* Note that we also switched to BCRYPT, which will always be 60 characters.
*/
$options = [
'cost' => 12,
];
$hash1 = password_hash("mandeep", PASSWORD_BCRYPT, $options);
echo $hash1. "<br>";
// $hash = '$2y$07$BCryptRequires22Chrcte/VlQH0piJtjXl.0t1XkA8pw9dMXTpOq';
if (password_verify('mandeep', $hash1)) {
echo 'Password is valid!';
} else {
echo 'Invalid password.';
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment