I read that one way to store passowrds in a database is as follows. To have a database table with columns, username, hash and salt. Salt will never be shown.
I generate a password hash + salt. The password is sent by the user and is not stored in the database. If the generated hash matches the one stored in the database, the password is correct.
But I have doubts. If I send a password, it will be possible to smell it while it will be transmitted by wire, so I think that it is also necessary to encrypt the message. So using a hash and salt is only protecting data from the administrator? I mean, if I save the password in the database, the administrator can easily access all the information. If I store a hash, administrators cannot access user information, because the administrator does not have half of the information, only salt, not password. However, although the user needs to send a password, it can be sniffed by someone, so the password is revealed.
What is the best way to protect user information?
Thanks.
source share