Bug #69707 [Opn->Csd]: Crypt outputs different hash depending on PHP version
| From: | jdavis at outlook dot com | Date: | Mon, 25 May 2015 20:12:36 +0000 |
| Subject: | Bug #69707 [Opn->Csd]: Crypt outputs different hash depending on PHP version | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-192886@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=69707&edit=1
ID: 69707
User updated by: jdavis at outlook dot com
Reported by: jdavis at outlook dot com
Summary: Crypt outputs different hash depending on PHP
version
-Status: Open
+Status: Closed
Type: Bug
Package: hash related
Operating System: Linux
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
The salt is 2 characters too short, this is causing the unexpected output.
Previous Comments:
------------------------------------------------------------------------
[2015-05-25 20:01:51] jdavis at outlook dot com
Description:
------------
Using the crypt function, identical code will result in an output that will vary depending on the
PHP version.
Test script:
---------------
<?php
$salt = "KFtIFW1vulG5nUH3a0Mv";
$password = "testtest";
$key = '$2y$07$';
$key = $key.$salt."$";
echo crypt($password, $key);
?>
Expected result:
----------------
I expect the result to be the same for every version, as this function can be used for
login/passwords and updating PHP can result in an unusable login.
Actual result:
--------------
An example can be seen here: http://3v4l.org/qqHUe
-Output for 5.3.7 - 5.4.41, 5.5.21 - 5.5.25, 5.6.5 - 5.6.9:
$2y$07$KFtIFW1vulG5nUH3a0Mv$.0imhrNa/laTsN0Ioj5m357/a8AxxF2q
-Output for 5.5.0 - 5.5.20, 5.6.0 - 5.6.4:
$2y$07$KFtIFW1vulG5nUH3a0Mv$e0imhrNa/laTsN0Ioj5m357/a8AxxF2q
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=69707&edit=1