Md5 User Registration Form


I have this tiny problem with the syntax.

I want a registration post form which sends and saves the passwort with
an MD5 crypt.

So this is the part of the form:

<%= f.password_field :password %>

and this is the source to crypt the password:

password = params[:password]
password = Digest::MD5.hexdigest(password)

But how can I crypt the password before posting?

Greetings Andi

If nobody knows that, mayby someone can tell me how update the :password
befor saving?

Greetings Andi