title: How do I implement salt into my login for passwords?
body: <p>I want to implement a salt into my login system but am a bit confused on how this is supposed to work. I can't understand the logic behind it. I understand md5 is a one-way algorithm and all of the functions that I have come across seem to hash everything together. If this is the case, how does one get the password back out for comparison? My biggest question is, how is salting a users' password safer than just hashing the password? If a database was ever to be compromised, the hash along with the salt is in the database. Isn't this all that a hacker would need?</p>
  
  <p>I also found another post here on SO where another developer said :</p>
  
  <blockquote>
    <p>"Ensure your salt and algorithm are
    stored <strong>separately from</strong> the database"</p>
  </blockquote>
  
  <p>I would like to store the salt in the database. Is this really a problem if I do?</p>
  
  <p>I'm looking for some help on understanding how this works and also what the best practice might be. Any help is greatly appreciated.</p>
  
  <hr>
  
  <p>EDIT:
  I want to thank everyone for their responses and ideas. Even though I may be more confused now, it has certainly been a learning experience for me. Thanks again guys.</p>