What is a good way to produce a random “site salt” to be used in creating password retrieval tokens?
问题 I would like to create a site-wide hash to be used as salt in creating password retrieval tokens. I have been bouncing around stackoverflow trying to get a sense of the best way to do this. Here's the reset process: When a user requests a password reset email the code generates a retrieval token: $token = hash_hmac('sha256', $reset_hash* , $site_hash) *$reset_hash is a hash created using phpass HashPassword() function, saved in the user table. I then send the token in a URL to the users email