1
0
mirror of https://github.com/php/php-src.git synced 2026-04-04 22:52:40 +02:00

Merge branch 'PHP-5.5' of git.php.net:php-src into PHP-5.5

* 'PHP-5.5' of git.php.net:php-src:
  Fix #64745 hash_pbkdf2 truncation issue
This commit is contained in:
Dmitry Stogov
2013-05-29 00:02:37 +04:00
3 changed files with 24 additions and 0 deletions

4
NEWS
View File

@@ -5,6 +5,10 @@ PHP NEWS
-FPM:
. Fixed Bug #64915 (error_log ignored when daemonize=0). (Remi)
- Hash:
. Fixed Bug #64745 (hash_pbkdf2() truncates data when using default length
and hex output). (Anthony Ferrara)
23 May 2013, PHP 5.5.0 Release Candidate 2
- Core:

View File

@@ -659,6 +659,9 @@ PHP_FUNCTION(hash_pbkdf2)
/* Setup Main Loop to build a long enough result */
if (length == 0) {
length = ops->digest_size;
if (!raw_output) {
length = length * 2;
}
}
digest_length = length;
if (!raw_output) {

View File

@@ -0,0 +1,17 @@
--TEST--
Bug #64745 hash_pbkdf2() truncates data when using default length and hex output
--SKIPIF--
<?php extension_loaded('hash') or die('skip'); ?>
--FILE--
<?php
$hash = hash_pbkdf2('sha1', 'password', 'salt', 1, 0);
$rawHash = hash_pbkdf2('sha1', 'password', 'salt', 1, 0, true);
var_dump($hash);
var_dump(bin2hex($rawHash));
?>
--EXPECT--
string(40) "0c60c80f961f0e71f3a9b524af6012062fe037a6"
string(40) "0c60c80f961f0e71f3a9b524af6012062fe037a6"