出于某种原因,我无法让我的函数返回一个字符串......
$password = crypt_password_input($password, "");
//Encrypt Password longer than 8 characters
function crypt_password_input($inputPassword, $newPassword)
{
$passwordLength = strlen($inputPassword);
if($passwordLength > 8){
$encryptString = substr($inputPassword, 0, 8);
$inputPassword = substr($inputPassword, 8);
$newPassword .= crypt($encryptString, "HIDDENSALT");
crypt_password_input($inputPassword, $newPassword);
}else{
$newPassword .= crypt($inputPassword, "HIDDENSALT");
echo "Final: " . $newPassword . "<br/>";
return $newPassword;
}
}
echo "Encrypted from the input: " . $password . "<br/>";
这是这个脚本的输出......
最终:ltu1GUwy71wHkltVbYX1aNLfLYltEZ7Ww8GghfM
从输入加密: