Bug #69707 [Csd->Nab]: Crypt outputs different hash depending on PHP version
Edit report at https://bugs.php.net/bug.php?id=69707&edit=1
ID: 69707
Updated by: rasmus@php.net
Reported by: jdavis at outlook dot com
Summary: Crypt outputs different hash depending on PHP
version
-Status: Closed
+Status: Not a bug
Type: Bug
Package: hash related
Operating System: Linux
PHP Version: Irrelevant
Block user comment: N
Private report: N
Previous Comments:
------------------------------------------------------------------------
[2015-05-25 20:12:35] jdavis at outlook dot com
The salt is 2 characters too short, this is causing the unexpected output.
------------------------------------------------------------------------
[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
Thread (3 messages)