Welcome Guest, Not a member yet? Register   Sign In
Using the PASSWORD() function
#7

Thanks that makes sense although I've not quite managed to strike a match with it, here is my example:

$hash password_hash($this->input->post('jbsPassword'), PASSWORD_DEFAULT);

if (
password_verify('$data['userData']['lc_password']'$hash)) {
    echo 
'Password is valid!';
} else {
    echo 
'Invalid password.';
}


The value of $data['userData']['lc_password'] was returning as:
*D426965E1031A24EC5DF16CD0DFE52E9407E4203

So then I tried to wrap the password from the database in to the password hash function like:

if (password_verify($this->hashPassword($data['userData']['lc_password']), $jbsPassword)) {

But that returns false too, the value of $this->hashPassword($data['userData']['lc_password'] is:
$2y$10$juxQdvYcKBf80AP.p3jCBOpESFYWG382X32VZZx4HHwKArN1A2kQe


So the last example I printed out the two vars, first from the database and then from the post data and I get:
Invalid password:

Arg one: $2y$10$juxQdvYcKBf80AP.p3jCBOpESFYWG382X32VZZx4HHwKArN1A2kQe
Arg two: $2y$10$w9fnaN4JY6LiwrXVrIN18.mbROYkJeiTGh5z9FqCEA9zxliRDquxK

my password_hash function:


public function hashPassword($password)

{

  return password_hash($password, PASSWORD_DEFAULT);
}

Does anything here look wrong?
Reply


Messages In This Thread
Using the PASSWORD() function - by barrypoore - 03-28-2018, 01:29 PM
RE: Using the PASSWORD() function - by jreklund - 03-28-2018, 02:24 PM
RE: Using the PASSWORD() function - by barrypoore - 03-28-2018, 02:49 PM
RE: Using the PASSWORD() function - by jreklund - 03-29-2018, 03:04 AM
RE: Using the PASSWORD() function - by barrypoore - 04-09-2018, 11:40 AM
RE: Using the PASSWORD() function - by jreklund - 04-09-2018, 12:50 PM
RE: Using the PASSWORD() function - by barrypoore - 04-09-2018, 01:44 PM
RE: Using the PASSWORD() function - by jreklund - 04-09-2018, 02:48 PM



Theme © iAndrew 2016 - Forum software by © MyBB