title: Encrypting Emails, Hashing Passwords, and Storing them in DB?
body: <p>First off, my understanding of encrypting and hashing:</p>
  
  <ol>
  <li>Encrypting - can be decrypted</li>
  <li>Hashing - can NOT be unhashed</li>
  </ol>
  
  <p>When building a web application, I should:</p>
  
  <ol>
  <li>Encrypt the email address (will be used to login) with encryption key. It's nice to be able to decrypt email addresses for later use (e.g. emailing users)</li>
  <li>Hash the password with a salt. No one should be able to see user's password, so hashing (since it is one-way) is good.</li>
  </ol>
  
  <p><strong>If the above 2 points are right, where should I store the encryption key and salt?</strong></p>
  
  <p>If I store it in the DB, the seems a bit pointless should the DB ever be compromised. The benefit, though, is that I can assign a unique encryption key and salt for each user.</p>
  
  <p>Should I store the encryption key and salt in my application's configuration? If the DB is ever compromised, at least the encryption key and salt are not also compromised (hopefully). The problem with this is that it probably means that everyone shares the same encryption key and salt.</p>
  
  <p>Suggestions on what to do?</p>