colap Posted August 11, 2015 Share Posted August 11, 2015 php crypt with same salt returns same crypted string, why? $crypted_withq = crypt('12345678q','salt'); $crypted_withoutq = crypt('12345678', 'salt'); echo $crypted_withq; echo '<br/>'; echo $crypted_withoutq; It returns same output. saX6EvfO393Go saX6EvfO393Go How can i store different crypted password in database with php? Link to comment https://forums.phpfreaks.com/topic/297726-php-crypt-with-same-salt-returns-same-crypted-string-why/ Share on other sites More sharing options...
boompa Posted August 11, 2015 Share Posted August 11, 2015 The answer is right in the documentation: It also only uses the first eight characters of str, so longer strings that start with the same eight characters will generate the same result (when the same salt is used). You should be using the password_hash function. Link to comment https://forums.phpfreaks.com/topic/297726-php-crypt-with-same-salt-returns-same-crypted-string-why/#findComment-1518460 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.