问题
Migrating old .net application to new php application: getting issue while implementing password encrypt/decrypt with sha1 alogorithm
As I mentioned, I am trying to implement password encryption and decryption (in new php app) while registration and login flows. I am using sha1() php function for password encrypt and decrypt. I have to implement sha1 functionality through which old app (.net app, with sha1 algorithm) users should also get new php app login with old passwords.
My php sha1 code during login:
..
..
$user_pass = $q->row('password'); //password stored in db (generated through .net sha1)
$inputPwd = utf8_decode(sha1($password, TRUE)); //password entered during login
if($inputPwd === $user_pass) {
return $q->row();
}
..
..
Issue that in above code snippet, both values are not matching.
If I register new user in php app. then he is getting login properly.
Only not getting login to migrated users (from .net)
Getting minor differences in both passwords, one generated through .net sha1 algorithm and another one I am generating through php sha1 algorithm during login to match both passwords.
getting little bit difference between them
Getting Passwords Like:
1) 7e???/?uH?}?QP&?e (php), 2) 7e???/?uH?}?QP&??e (.net)
please suggest me any changes or ideas so that I can match php generated sha1 password with old .net sha1 generated password.. to get login properly.
My PHP Version: 7.1
来源:https://stackoverflow.com/questions/61865164/migrating-old-net-application-to-new-php-application-getting-issue-while-imple