Going from unsalted to salted MD5 passwords

md5, php

Solution

You can do a "2 step hashing" instead of creating a hash in a single step.

You could append each password hash to the username, and then hash it again. This will create an undecryptable hash thats salted with unique informations.

The usual process of salting is

salt+PWD -> hash

You could do something like: PWD -> Hash -> UserID+Hash -> Hash

(Note the UserID was only picked so a unique salt for each double hash exists... Feel free to make your salt more complex)

Problem

I have a LAMP (PHP) website which is becoming popular. I played it safe by storing the user passwords as md5 hashes. But I now see that's not secure; I should have salted the md5 hash - because it's currently possible to decode unsalted md5 hashes using rainbow tables. What can I do? I don't want to make everyone type a new password.

Original source