简体   繁体   中英

ASP.NET Membership Password Answer Value in PHP

Any one knows how to make Password Answer value with PHP? This is required when we change or reset password. I've figured out how to make Password value, but this method doesn't work for Password Answer value.

$salt = '9IrVZRGqwEMfzG3aFdrzEg=='; // Straight from the DB
$password = 'password'; // Password value in text

$salt = base64_decode($salt); 
$utf16Password = mb_convert_encoding($password, 'UTF-16LE', 'UTF-8');
echo base64_encode(sha1($salt . $utf16Password, true));

There might be a way to get it as above. Please help me. Thank you.

I finally found the solution. This is the source.

$answer = strtolower($answer);
$utf16Answer = mb_convert_encoding($answer, 'UTF-16LE', 'UTF-8');
echo 'Calculated Answer<br/>', base64_encode(sha1($salt . $utf16Answer, true)), '<br/>';

ASP.NET makes the answer value to lower case. Everything is the same as password.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM