Skip to content

Commit 852337c

Browse files
committed
[ticket/13917] Use hash_equals() if it's available
PHPBB3-13917
1 parent db3782e commit 852337c

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

phpBB/phpbb/passwords/driver/helper.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,12 @@ public function get_random_salt($length, $rand_seed = '/dev/urandom')
153153
*/
154154
public function string_compare($string_a, $string_b)
155155
{
156+
// Use hash_equals() if it's available
157+
if (function_exists('hash_equals'))
158+
{
159+
return hash_equals($string_a, $string_b);
160+
}
161+
156162
$difference = strlen($string_a) != strlen($string_b);
157163

158164
for ($i = 0; $i < strlen($string_a) && $i < strlen($string_b); $i++)

0 commit comments

Comments
 (0)