Created
January 29, 2015 06:20
-
-
Save ghecho/2c4d2898e0253abeb592 to your computer and use it in GitHub Desktop.
PHP BCrypt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?PHP | |
echo better_crypt("password"); | |
if(password_verify("password", better_crypt("password"))) { | |
// password is correct | |
echo "<br><br>"; | |
echo "password correct"; | |
} | |
function better_crypt($input, $rounds = 8) | |
{ | |
// Original PHP code by Chirp Internet: www.chirp.com.au | |
// Please acknowledge use of this code by including this header. | |
$crypt_options = array( | |
'cost' => $rounds | |
); | |
return password_hash($input, PASSWORD_BCRYPT, $crypt_options); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment