Jump to content

php crypt function


mbrown

Recommended Posts

How can you specify the salt but allow for all combinations? What I want to do is to utilize crypt to hash my passwords with a salt but as I am well aware each time it generates the hash, the salt is difference so the stored hash is different. If there a way to determine what the salt is? Either way when I know what the salt is, I will have to store it in my database table as the salt for each user will be different.

 

Thanks

 

M. Brown

Link to comment
https://forums.phpfreaks.com/topic/262757-php-crypt-function/
Share on other sites

you only need to store the crypt'd password

 

per, php.net example:

/* You should pass the entire results of crypt() as the salt for comparing a
   password, to avoid problems when different hashing algorithms are used. (As
   it says above, standard DES-based password hashing uses a 2-character salt,
   but MD5-based hashing uses 12.) */
if (crypt($user_input, $password) == $password) {
   echo "Password verified!";
}

Link to comment
https://forums.phpfreaks.com/topic/262757-php-crypt-function/#findComment-1346786
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.