Change password to md5 hash before inserting in db

Using V5 and mysql for database.
On my add new user form, I want to take the field and before saving it to the database, want to create an md5 hash and actually use that in my user table field called password instead of the password that they type.

What’s the best way to accomplish this?

Re: Change password to md5 hash before inserting in db

Maybe there is a better way, but what I ended up doing was as this code to the onbeforeinsert

{Password} = md5({Password});

and since the password field shows asterisks instead of the text, and when the user has registered, I go to the login screen, it works very well.

Re: Change password to md5 hash before inserting in db

or use the OnValidate event.

Re: Change password to md5 hash before inserting in db

In my forms with passwords, I create a new dummy field that is always blank. The real password field is present but hidden. Then user can then ‘reset’ the password and event of your choice to update the field:
{password_field} = md5({input_password});

As password sniffers are a dime a dozen, it help to never display the password even it is ‘******’.
Plus that helps by not presenting the # of chars in the pass.

Regards,
SCott.