RE: [PHP] function use in sql -- md5

From: Date: Wed, 15 Nov 2000 04:50:33 +0000
Subject: RE: [PHP] function use in sql -- md5
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-25359@lists.php.net to get a copy of this message
On 15-Nov-00 Philip Olson wrote: > Hi friends! > > I have a mysql column full of plain text passwords that I'd like to hash > via MD5. I can think of looping through and updating through php but am > hoping to learn a little trick to speed up similar activities in the > future. All thoughts and tips welcome for updating, ideally at the shell > level, which is one of my current weaknesses. This will not work but is > the idea (after setting (32) : > > update mycolumn > set mycolumn = md5(mycolumn); > > What would be proper syntax to complete this goal? How would YOU approach > this? > If you want to be compatible with /etc/passwd format: (assumes your libcrypt knows a $1$ salt is md5) alter table my_table add new_pass char(35) not null default '*'; update my_table set new_pass=encrypt(old_pass,'$1$'); verify every thing is hunky-dory, drop old_pass & rename new_pass. Regards, -- Don Read dread@texas.net -- The problem with people who have no vices is that you can be sure they're going to have some pretty annoying virtues.

« previous php.general (#25359) next »