password_verify() PHP 5.5.12 Not working

Asked

Viewed 137 times

1

I’m having trouble with password_verify (). A few days ago, the same password and hash worked perfectly. Today, password_verify returns false, but I know the password is correct.

$senhaC = '$2y$10$15rGMwy5CEHaLrNzEEwaZ.G2.VbhumhXtcORad0cC7W6SkjuZ.XJG';
$senha  = 'tgipassword';

var_dump(password_get_info($senhaC));

if (password_verify($senha, $senhaC)) {
    echo 'Ok';
}
else {
    echo 'No Ok';
}

var_dump returns:

array (size=3)
  'algo' => int 1
  'algoName' => string 'bcrypt' (length=6)
  'options' => 
    array (size=1)
      'cost' => int 10

When it was created and saved in the bank it was using:

$options = [
    'cost' => 10
]; 
$senhaC = password_hash('tgipassword', PASSWORD_DEFAULT, $options); 

I do a search in the bank it returns me this hash but in the verification with the correct password returns false, the strange thing is that I used this password a few days ago checking as true and I know that the password was not changed.

  • Ever tried to update the password? to see?

  • Did not set any jump on password_hash?

  • The php version has changed?

  • When I do the function of my software that will govern the password, I put the same it will govern and it works. The strange thing is not working something that was.

  • The PHP version was not changed, I did not configure any salt. I only used that described in the question, cost 10 and PASWORD_DEFAULT.

  • My fear is a user trying to log in and not working saying the password is wrong and the password is right.

Show 1 more comment
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.