I don't understand how using a random salt for hashing passwords can work.  Perhaps random salt refers to something other than hashing passwords?  Here is my thought process:


The salt is used to add extra junk to the end of a password prior to hashing it, to fight against the likelihood of being cracked by a rainbow table
However to ensure you can still verify a password is correct, you must use the same salt for each password prior to encrypting it to see if it matches the hash saved for a certain user
If a random salt is used, how can that password ever be verified again?  Is the random salt saved somewhere to be used for each encryption?  Seems less secure to me if the salt is saved right alongside the hashed password, rather than using some kind of computed salt an attacker would not inherently know if they got a hold of your data.


I'm not sure if I'm missing something here, or if random salting has to do with a different scenario in encryption, and doesn't make sense in this particular case.  How can a random salt work in the above case of hashing passwords prior to encrypting?


  Is the random salt saved somewhere to be used for each encryption?


Yes


  Seems less secure to me if the salt is saved right alongside the hashed password, rather than using some kind of computed salt an attacker would not inherently know if they got a hold of your data.


It's not, because the only thing a salt does and was invented to do is, as you said:


  to fight against the likelyhood of being cracked by a rainbow table


and nothing more. It adds complexity to a single password - and for every password in a database, it is unique. To verify the password, you need to store it alongside it. This doesn't compromise the security of that single password in the least bit - the hash algorithm is still as secure as without a salt.

But, looking at the whole database, every password is better protected against rainbow attacks, because the attacker must calculate very single hash with the respective salt separately and cannot do bulk operations on them.
