Skip to content

Instantly share code, notes, and snippets.

@YurePereira
Last active January 14, 2018 06:22
Show Gist options
  • Select an option

  • Save YurePereira/56a4d0330588ef5c6f5774ea8abf4239 to your computer and use it in GitHub Desktop.

Select an option

Save YurePereira/56a4d0330588ef5c6f5774ea8abf4239 to your computer and use it in GitHub Desktop.
Comparando uma senha hash com uma senha entrada,
<?php
//Senha supostamente obtida por um banco de dados:
$hashPassword = '$2y$11$60E.YbPVdujZB5pt71C51.FTKINFQnkdyPFttgeRtLdUbOlZTD0.S';
//Senha supostamente entrada por usuário para comparação:
$passwordInput = 'myPassword';
if (password_verify($passwordInput, $hashPassword)) {
echo 'Senha correta!';
} else {
echo 'Senha incorreta!';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment