I'm using a simple method of modifying a password so that it is not stored in plain text. This is on a production database and application and it has worked up until switching from Windows Server 2003 to 2012.
private function simpleCrypt($password) {
$text = strtoupper(trim($password));
$chars = str_split($text);
$password2 = '';
foreach ($chars as $char) {
$asciivalue = ord($char);
if ($asciivalue < 128) {
$newasciivalue = $asciivalue + 128;
$newchar = chr($newasciivalue);
$password2 = $password2 . $newchar;
} elseif ($asciivalue > 128) {
$newasciivalue = $asciivalue - 128;
$newchar = chr($newasciivalue);
$password2 = $password2 . $newchar;
}
}
return $password2;
}
When ever my password gets ran through this script it shows me a result of �� vs the actual encoded password that was generated by the other system on 2003. It shows correct "western" characters. If I use Firefox and change text encoding to western however it shows me the correct database representation of the password. I've tried adding meta to my header on the login page thinking that it would correct this but I get the same result.
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">