Reputation: 10068
I need to transfer some hashed password on a new server from old one. Old server has php 5.4.4 and crypt() function on password return a string 102 characters. My new server has php 5.5.7 and crypt function return a string of 34 characters. On both server, crypt is called without parameters
crypt($password);
On user login (on old server) i use this code:
crypt($_POST['password'], $hash_password) == $hash_password
Now, if i copy hash passwords to new hosting, and i call that method for check if password is correct, password never match. How can i do to make the same type of hashing to that different server?
this is an example of two crypted password:
on old server:
$6$kcPF.fPojej2$YF5Ui0nP8t5Wc0JVVEI9.JD2l/ZyLQGL6T5RN3E5oz3GGiSZoTBsbocMggLkdlBhO6Xe7cGdepW7bo6mKFjYx1
on new server
$1$Sz1cDmU0$Z0uoEwnXH1NokqPwwQJsp/
Upvotes: 2
Views: 223
Reputation: 173562
The old server is using the SHA256 algorithm to create hashes, but the new server doesn't seem to support it; in other words, the constant CRYPT_SHA512
is 0
.
Depending on how PHP is installed on the new server you may have to check whether libcrypt
is recent enough or contact the hosting company that provides the server.
Upvotes: 2