If I have a random, 16 character long, alphanumeric salt (varying case) that is generated and stored per user, do I need a site wide salt as well?
In other words, is this good?
sha1($user_salt . $password)
should I do this instead?
sha1($user_salt . $password . $site_salt)
Also,
At the moment, I have an encrypted cookie, that looks up a session in a DB. In this session, there is an user_id and an user_token. I then query the DB using the user_id -- if the sha1 of the user_id+hash in DB === user_token, then the user is allowed through.
I do the second query for the user_id on every page load so that if I delete, ban or change the password of an user, the action has immediate effect.
This is what I've come up looking through websites and questions here. What do you think? Did I miss something?
I need to add role checking but that would probably add yet another query (3rd one just for auth). Any tips?