I'm using random (extended) ASCII characters to salt my passwords. When users log in, I combine the stored random salt with the submitted password, hash the whole thing, and compare to the hash stored in the database. This currently works fine on both my production and backup server.
However, I just built a new server to take the place of my production server (separating Apache from MySQL) and PHP doesn't appear to support extended ASCII on the new server.
Here's how I reached this conclusion:
I echoed the salted password to the screen - it was correct.
I echoed the two non-matching password hashes to my browser. They looked something like: "8abc91823496laadsoinb / 7812340asdofijqkwre8714".
I tried comparing the passwords using MySQL: "SELECT MD5(CONCAT('original_password',salt)) AS pw1, stored_hash AS pw2" - THEY MATCH!
I echoed just the salted password to a text box in my browser, copied it, and pasted it into query above: "SELECT MD5('copiedpassword12498utwrjsag') AS pw1, stored_hash AS pw2" - NO MATCH...however, it now matches the two hashes from step 2.
I then noticed that a few of my extended ASCII characters had been altered by the cut/paste (thank you, Windows clipboard). The fact that it gives me same incorrect hash from step #2 confirms to me that my new server is also screwing up the extended characters.
I don't know if this is a PHP problem, an Apache problem or what. Maybe it has something to do with the fact that the MySQL server is now connected remotely(?). However, I have a suspicion that I forgot to install something. 😕
Any clues?