MySQL PASSWORD() function
Posted on 2006-06-07
So I'm revamping a client's already existing website and tearing my hair out over how poorly designed the existing framework is. The previous developer has all the user passwords encrypted in the database using MySQL's PASSWORD() function, rather than using something like md5() or sha1(). Trust me, I understand completely that this is bad practice, but I need to try and salvage the situation. The MySQL manual itself cautions against doing this, since they've been known to change their PASSWORD() algorithms from time to time. What I'm wondering is this:
What is the PHP equivalent of MySQL's password function? (I'm looking for code here--some function or algorithm that will produce the same value as MySQL's PASSWORD() function.) He's got MySQL v4.0.27, and I'd like to have the passwords encrypted by PHP functions in a consistent manner so that future upgrades to MySQL don't all of a sudden "break" his entire website.