I've been reading about this lately and I just don't get it. Here's what I understood so far. Let's say that I have a website with 100 users. Each of them has the password pass1, pass2,... , pass100. When I store the password in the database encrypted I use something like md5("n9f84dpass2") for generating the password for user 2 with the salt n9f84d. Now how does that help if someone gains access to my database and finds the 32 hex digits (encrypted passwords)? Suppose he uses rainbow tables and finds the password "n9f84dpass2". Is it that hard from this point to guess which is the salt and which is the password?
It not complicated the idea is quite simple. You salt because the hash generated would be different. Now md5 is a one way compression function ( hash ) , you can really get a password from md5 unless you recalculate all the hashes. Online people have databases with md5'ed strings with no salt. So if you use salt , and the attacker gets the hash he still needs the salt to get authenticate. even if he knows the salt he needs to generate all possible passwords to get the password . So by using salt you are actually more secure. But the problem comes when you do data migration , when you move from one script to other a default md5 might be easily supported . But to support salted md5 it might require script modifications.