Created
May 28, 2015 19:39
-
-
Save everaldo/9387b04efb46196376c7 to your computer and use it in GitHub Desktop.
Senhas com password verify (a partir do PHP 5.5.0 - 20 de Junho de 2013)
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 | |
$senha = 'Of!cinaDePr0gramaçã0'; | |
$hash = password_hash($senha, PASSWORD_DEFAULT); | |
$salt = substr($hash, 7, 22); | |
$verificacao = password_verify($senha, $hash) ? "Verdadeiro" : "Falso"; | |
$teste_falso = password_verify("N@oEhaSenha", $hash) ? "Verdadeiro" : "Falso"; | |
?> | |
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset=utf-8 /> | |
<title>Senhas com Password Hash (a partir do PHP 5.5.0)</title> | |
</head> | |
<body> | |
<h1>Senhas com a função password_hash()</h1> | |
<p> | |
<b>Senha:</b> <?php echo $senha ?></br> | |
<b>Hash:</b> <?php echo $hash ?></br> | |
<b>Salt:</b> <?php echo $salt ?></br> | |
<b>Verificação:</b> <?php echo $verificacao ?></br> | |
<b>Teste Senha Incorreta:</b> <?php echo $teste_falso ?></br> | |
</p> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment