A good way to salt password?
I have read a few answers related to salting password. But I started to get confused.
I came across few functions people used to generate salt like:
- mcrypt_create_iv()
- openssl_random_pseudo_bytes()
- pseudo random bits and the answer tells almost everything about salt
- use cryptographic nonce for password by @Rook (maybe I misunderstood)
So many functions out there, so which one I need use?
and one mini question:
What I know is salt must be as random as possible for each user's password. Currently I am using pseudo random bits (as in third in above list) to generate salt to bcrypt->hash(salt+password) and store the salt together with password in same row in mysql. Am I implement this wrong?