note 117101 added to function.hash-equals
| From: | CedricVanBockhaven | Date: | Wed, 15 Apr 2015 09:01:36 +0000 |
| Subject: | note 117101 added to function.hash-equals | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-202269@lists.php.net to get a copy of this message | ||
Our server does not support the hash_equals function. We are using the following snippet which also
has support for strings of different length:
<?php
if(!function_exists('hash_equals')) {
function hash_equals($a, $b) {
$ret = strlen($a) ^ strlen($b);
$ret |= array_sum(unpack("C*", $a^$b));
return !$ret;
}
}
?>
----
Server IP: 72.52.91.14
Probable Submitter: 188.207.85.39
----
Manual Page -- http://php.net/manual/en/function.hash-equals.php
Edit -- https://master.php.net/note/edit/117101
Del: integrated -- https://master.php.net/note/delete/117101/integrated
Del: useless -- https://master.php.net/note/delete/117101/useless
Del: bad code -- https://master.php.net/note/delete/117101/bad+code
Del: spam -- https://master.php.net/note/delete/117101/spam
Del: non-english -- https://master.php.net/note/delete/117101/non-english
Del: in docs -- https://master.php.net/note/delete/117101/in+docs
Del: other reasons-- https://master.php.net/note/delete/117101
Reject -- https://master.php.net/note/reject/117101
Search -- https://master.php.net/manage/user-notes.php