How can I compare my PHPASS-hashed stored password to my incoming POST data?

Posted by Ygam on Stack Overflow See other posts from Stack Overflow or by Ygam
Published on 2009-08-19T03:32:41Z Indexed on 2010/06/12 8:53 UTC
Read the original article Hit count: 293

Filed under:

Here's a better example, just a simple checking..stored value in database has password: fafa (hashed with phpass in registration) and username: fafa; i am using the phpass password hashing framework

public function demoHash($data) //$data is the post data named password
{

	$hash =new PasswordHash(8, false);
	$query = ORM::factory('user');
	$result = $query
		->select('username, password')
		->where('username', 'fafa')
		->find();
	$hashed = $hash->HashPassword($data);
	$check = $hash->CheckPassword($hashed, $result->password);
	echo $result->username . "<br/>";
	echo $result->password . "<br/>";
	return $check;
}

check is returning false

© Stack Overflow or respective owner

Related posts about php