Doc #61619 [NEW]: Bcrypt in crypt() fails for cost value less then 10
| From: | e dot zimuel at gmail dot com | Date: | Wed, 04 Apr 2012 09:12:07 +0000 |
| Subject: | Doc #61619 [NEW]: Bcrypt in crypt() fails for cost value less then 10 | ||
| Groups: | php.doc.bugs | ||
| Request: | Send a blank email to doc-bugs+get-8164@lists.php.net to get a copy of this message | ||
From:
Operating system: linux
PHP version: 5.3.10
Package: Documentation problem
Bug Type: Documentation Problem
Bug description:Bcrypt in crypt() fails for cost value less then 10
Description:
------------
The bcrypt algorithm in the crypt() function fails for cost values less
than 10. In the documentation is written that the values to use are in the
range 4-31, this range should be 10-31.
---
From manual page:
http://www.php.net/function.crypt#refsect1-function.crypt-description
---
Test script:
---------------
$password= '12345678';
$salt = '1234567890123456789012';
for($i=4;$i<=12;$i++) {
$hash = crypt($password,'$2a$'.$i.'$'.$salt);
echo ( strlen($hash)<=13 ? "Fails: $hash \n" : "Ok: $hash\n");
}
Expected result:
----------------
Ok: $2a$4$123456789012345678901u...
Ok: $2a$5$123456789012345678901u...
Ok: $2a$6$123456789012345678901u...
Ok: $2a$7$123456789012345678901u...
Ok: $2a$8$123456789012345678901u...
Ok: $2a$9$123456789012345678901u...
Ok: $2a$10$123456789012345678901uOmjxspUyFLEdp6mxJQ4iRnbKlKw1aH6
Ok: $2a$11$123456789012345678901ubLT1mu4s43rkUv0UK6fLURb3WhhPi1.
Ok: $2a$12$123456789012345678901uwZOx4Im8nWhwn3NpS/SBswvxBysXf5q
Actual result:
--------------
Fails: $2lH9Bbg1vo/g
Fails: $2lH9Bbg1vo/g
Fails: $2lH9Bbg1vo/g
Fails: $2lH9Bbg1vo/g
Fails: $2lH9Bbg1vo/g
Fails: $2lH9Bbg1vo/g
Ok: $2a$10$123456789012345678901uOmjxspUyFLEdp6mxJQ4iRnbKlKw1aH6
Ok: $2a$11$123456789012345678901ubLT1mu4s43rkUv0UK6fLURb3WhhPi1.
Ok: $2a$12$123456789012345678901uwZOx4Im8nWhwn3NpS/SBswvxBysXf5q
--
Edit bug report at https://bugs.php.net/bug.php?id=61619&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=61619&r=trysnapshot54
Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=61619&r=trysnapshot53
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=61619&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=61619&r=fixed
Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=61619&r=needdocs
Fixed in release: https://bugs.php.net/fix.php?id=61619&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=61619&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=61619&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=61619&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=61619&r=support
Expected behavior: https://bugs.php.net/fix.php?id=61619&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=61619&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=61619&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=61619&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=61619&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=61619&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=61619&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=61619&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=61619&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=61619&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=61619&r=mysqlcfg