note 117101 deleted from function.hash-equals by cmb
| From: | cmb@php.net | Date: | Thu, 29 Jul 2021 12:42:21 +0000 |
| Subject: | note 117101 deleted from function.hash-equals by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-216683@lists.php.net to get a copy of this message | ||
Note Submitter: Cedric Van Bockhaven
----
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;
}
}
?>