2
When creating a user, I do the following to criptografar
the password:
$options = ['cost' => 12];
$encripted = password_hash($this->input->post('senha'), PASSWORD_BCRYPT, $options);
When logging in I do the following:
$result = $this->db->get('users');
$db_password = $result->row(2)->senha;
if (password_verify($senha, $db_password)) {
return true;
} else {
return false;
}
But I always fall in the FALSE.
OBS: I put a print_r
to verify the value of the db_password
brings the hash
correct.
It looks normal, try using the
PASSWORD_DEFAULT
hashed.– Leonardo
It does not cost to ask: checked if the hash is being truncated in the database, for example, let’s say that the field of the database is varchar(50). In the case of the PASSWORD_BCRYPT algorithm 60 characters are required.
– resmall
Our... worst... that’s right... boy didn’t even realize it. rsrssr.. thank you
– novato