Quantcast
Channel: Active questions tagged charset - Stack Overflow
Viewing all articles
Browse latest Browse all 59

Character encodings for all integers from 0 to 255 [duplicate]

$
0
0

I have a page that encrypts a user's login and password. The user inputs a key, login and password. I add the ascii value of the first character of the key to the ascii value of the first character of the login, 2nd character of the key to the 2nd character of the login, and so on. I do this for each character of the login and password. I then put the new characters back into a string and store it in MySQL. When I first created this page, it worked fine and I stored dozens of login/password/key combinations. There were no missing or wrong characters. My web host service eventually changed to cPanel, and when they did, most of the encrypted characters were lost and just became a black diamond with a question mark. I didn't know much about character sets, and didn't need to because everything was working. I've done some research into character sets now and have discovered that 0-31 and 127-160 aren't used in most character sets. But many of the characters I store in the MySQL file fall into that range. I don't know why it worked pre-cPanel, but now I have a lot of missing characters. Is there a character set I can use in my web page coding and MySQL fields that will allow me store the full range from 0 to 255?

Here are the settings from my php files:       

My MySQL collation was the default latin1_swedish_ci. 

I have tried changing the collation for the MySQL fields, and I've tried changing the charset in my php files. They work as expected, and I get a question mark when the new value of the character is in a range that's not used. I just want to know why that didn't happen before the change to cPanel and how I can get back to that.

Update: After researching password_hash and password verify, I should probably clarify what I'm actually trying to achieve. I'm storing passwords in the MySQL file as kind of a password manager. So when a user forgets their password (or other sensitive pieces of info), they can look it up by using their key. But that requires two-way hashing. So password_hash won't work for this application. Is there a standard two-way hash function?


Viewing all articles
Browse latest Browse all 59

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>