For several years, I asked here about stackoverflow on how to make PHP password storage safe. The main answer suggests using the following hashing algorithm:
function hash_password($password, $nonce) { global $site_key; return hash_hmac('sha512', $password . $nonce, $site_key); }
In response, it is suggested to use random nonce. Is there any advantage in that you have a random exception compared to simple unique ones?
For example, each user can have his own identifier, which does not change. However, let them assume that the user IDs are sequential (built with MySQL auto-growth function) and therefore are not random. Would a user id be good or nonrandom?
Now each user can choose a username. Each user has a username that does not change, and two different users cannot have the same username. Usernames are still not random, but they are also not sequential. Will usernames be good enough like nonce? Would it be better than using a user id?
security php password-storage hash hmac
luiscubal
source share