jasonc Posted December 30, 2011 Share Posted December 30, 2011 I used the very bad method of storing password as text and would like to convert them all to SHA1, can this be done using a single query ? Link to comment https://forums.phpfreaks.com/topic/254087-how-do-i-convert-all-password-as-text-to-sha1/ Share on other sites More sharing options...
PFMaBiSmAd Posted December 30, 2011 Share Posted December 30, 2011 Just use an UPDATE query, without a WHERE clause, to set the password field to be the sha1 of the password field, provided you have a known good backup of your database (just in case) and the password field length is sufficient to hold a sha1 value. Link to comment https://forums.phpfreaks.com/topic/254087-how-do-i-convert-all-password-as-text-to-sha1/#findComment-1302610 Share on other sites More sharing options...
fenway Posted December 30, 2011 Share Posted December 30, 2011 Just use an UPDATE query, without a WHERE clause, to set the password field to be the sha1 of the password field, provided you have a known good backup of your database (just in case) and the password field length is sufficient to hold a sha1 value. Safer way is to add another column until you're certain you've done it correctly. And it's not always "very bad" to store them as text -- depends what they're protecting. Link to comment https://forums.phpfreaks.com/topic/254087-how-do-i-convert-all-password-as-text-to-sha1/#findComment-1302627 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.