Commit f9022924 by Daniel Ruf

added hash_equals polyfill for old PHP versions

parent 2e1f5aa3
......@@ -203,6 +203,20 @@
require_once QA_INCLUDE_DIR.'vendor/password_compat.php';
}
// http://php.net/manual/en/function.hash-equals.php#115635
if(!function_exists('hash_equals')) {
function hash_equals($str1, $str2) {
if(strlen($str1) != strlen($str2)) {
return false;
} else {
$res = $str1 ^ $str2;
$ret = 0;
for($i = strlen($res) - 1; $i >= 0; $i--) $ret |= ord($res[$i]);
return !$ret;
}
}
}
// http://stackoverflow.com/a/18277167
function ipv6_numeric($ip) {
$binNum = '';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment