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 ? Quote 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. Quote 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. Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.