php-src/ext/hash/tests/bug64745.phpt
Anthony Ferrara 540a5a52e8 Fix #64745 hash_pbkdf2 truncation issue
When using hash_pbkdf2 with hex output and 0 length (auto), it incorrectly
truncates the result to 1/2 the expected result.
2013-05-28 15:30:45 -04:00

18 lines
456 B
PHP

--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"