From 540a5a52e89fce6da19d6f79dd1eda587a25b396 Mon Sep 17 00:00:00 2001 From: Anthony Ferrara Date: Tue, 28 May 2013 15:30:45 -0400 Subject: 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. --- ext/hash/hash.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'ext/hash/hash.c') diff --git a/ext/hash/hash.c b/ext/hash/hash.c index 9492387dbb..9cede14125 100644 --- a/ext/hash/hash.c +++ b/ext/hash/hash.c @@ -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) { -- cgit v1.2.1