Created
August 23, 2012 17:35
-
-
Save TiuTalk/3439186 to your computer and use it in GitHub Desktop.
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 | |
// Encriptando a senha | |
$senha = 'ola mundo'; | |
$hash = Bcrypt::hash($senha); | |
// $hash = $2a$08$MTgxNjQxOTEzMTUwMzY2OOc15r9yENLiaQqel/8A82XLdj.OwIHQm | |
// Salve $hash no banco de dados | |
// Verificando a senha | |
$senha = 'ola mundo'; | |
$hash = '$2a$08$MTgxNjQxOTEzMTUwMzY2OOc15r9yENLiaQqel/8A82XLdj.OwIHQm'; // Valor retirado do banco | |
if (Bcrypt::check($senha, $hash)) { | |
echo 'Senha OK!'; | |
} else { | |
echo 'Senha incorreta!'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment