diff options
| author | Anthony Ferrara <ircmaxell@gmail.com> | 2013-05-28 15:30:45 -0400 |
|---|---|---|
| committer | Anthony Ferrara <ircmaxell@gmail.com> | 2013-05-28 15:30:45 -0400 |
| commit | 540a5a52e89fce6da19d6f79dd1eda587a25b396 (patch) | |
| tree | 69d3bb628f8d3516c5acb0c23c2fd2f67365be56 /ext/hash/tests | |
| parent | 2f01e06786c6f4b2479fdb728bd26062d07208e0 (diff) | |
| download | php-git-540a5a52e89fce6da19d6f79dd1eda587a25b396.tar.gz | |
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.
Diffstat (limited to 'ext/hash/tests')
| -rw-r--r-- | ext/hash/tests/bug64745.phpt | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/ext/hash/tests/bug64745.phpt b/ext/hash/tests/bug64745.phpt new file mode 100644 index 0000000000..427f89b728 --- /dev/null +++ b/ext/hash/tests/bug64745.phpt @@ -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" + |
