MD5 encryption

6 posts by 2 authors in: Forums > CMS Builder
Last Post: February 9, 2009   (RSS)

As I understand reading in a previous thread, there is no functionality to save data encrypted as MD5. Is there a workaround I can use to add a field to MySQL capable of holding MD5 data? I am fairly comfortable with PHP. I see there is an option for a "password" field, but the password will still be saved as text?

thanks

Re: [Dave] MD5 encryption

I am building a member area where users can login to view their profile, etc. I have set up text fields in CMSB to store their username and password but of course they are stored as plain text. I would like to store the password encypted.

thanks

Re: [IronVictory] MD5 encryption

By Dave - February 9, 2009

Hi IronVictory,

There's now way to switch the default method that CMS Builder uses internally, but if you are writing add on script and forms to work with the mysql data you can encode a password as MD5 in MySQL like this: SELECT MD5("hello world");

or in PHP like this: md5("hello world");

Usually when we write edit/view profile sections on a site we have that as a separate script that loads the MySQL data rather than letting the website visitors access the CMS. It depends on the site though.

If you wanted to create a new column in the accounts database table called "password_md5" you could create an MD5 value for each password with this MySQL:

UPDATE cms.cms_accounts SET password_md5 = MD5(password)

Hope that helps!
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] MD5 encryption

Hi Dave,
Thanks for the info.

I guess the issue is the client wants to be able to add/update the members' username and passwords from within the site CMS (CMSB), but I am accessing the username & password externally in my members area script.

So if the client adds a new password within CMSB, there is no way for it to be saved as MD5, correct? If I create or update it externally, then of course i can save it as MD5, but then it won't show up in CMSB.

Re: [IronVictory] MD5 encryption

By Dave - February 9, 2009

There's no way for it to be saved within the CMS, no.

One last idea... If you're able to update your member area script, though, you could have it convert the password on the fly to MD5 either in PHP or MySQL for comparison.
Dave Edis - Senior Developer
interactivetools.com