title: How to store passwords in database securely?
body: <p>I have read that one way to store passowrds in a database is by the following way. To have a database table with columns username, hash and salt. The salt would never be shown.</p>
  
  <p>I generate the hash with password + salt. The password is send by the user and is not stored in the database. If the generated hash is the same as that stored in the database,  the password is correct.</p>
  
  <p>But I have my doubts. If I send the password, it could be sniffed while it is transmitted by the wire, so I think that it is neccesary to encrypt the communication too. So using a hash and salt is only to protect the data from the administrator? I mean that if I store the password in database, an administrator could easily access all information. If I store the hash, the administrators can't access to the information of users becasue the administrator don't have the half of the information, only the salt and not the password. However, while the user need to send the password, this could be sniff by someone, so the password is exposed.</p>
  
  <p>How is the best way to protect the information of the user?</p>
  
  <p>Thanks.</p>