I’m using phpass when my users type in password upon signup and login. It’s working when I’m working local on my Mac.
But when I hash a password when I’m online it’s like it’s hashing in a wrong way.
I have imported the local db to online db. And the password generated when I was local works perfect when I’m online.
So.. It’s like something’s going completely wrong when I’m using phpass online.
I’m using it like this:
$hasher = new PasswordHash(8, FALSE);
$password = HashPassword($_POST["password"]);
This would give me something like:
_zzD.NrhAaUmhr6G8i5E //when I'm local
$2a$08$mt3//cn0tqMmug/.tjKeC.AbZhYyj470EY9zSivZvNOtwk4A //when I'm online
When I’m checking password it’s like this:
$hasher = CheckPassword($_POST["password"], $row["password"]);
//$_POST is ofc. the submitted
//$row is the password for the user from the db.
//the user is found on the username and then im checking password.
I have absolutely no idea what’s wrong. I was hoping someone on SO have had same problems.
It is likely that your environments are using different hashing algorithms. You should ensure that both your development and production environments support blowfish encryption.
As a weaker alternative, this article mentions that:
The second option to the
PasswordHashconstructor is$portable_hasheswhich can force the library to produce (weaker) hashes which are safe to move between machines. Try using