Translated using Weblate (Czech)
[phpmyadmin.git] / libraries / hash.lib.php
blob6c90aa426e5638fe4d6a06a105da2f2520d6ea6c
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * The hash extension polyfills.
6 * @package PhpMyAdmin
7 */
9 if (! defined('PHPMYADMIN')) {
10 exit;
13 /* Compatibility with PHP < 5.6 */
14 if (! function_exists('hash_equals')) {
15 /**
16 * Timing attack safe string comparison
18 * @param string $a first string
19 * @param string $b second string
21 * @return boolean whether they are equal
23 function hash_equals($a, $b) {
24 $ret = strlen($a) ^ strlen($b);
25 $ret |= array_sum(unpack("C*", $a ^ $b));
26 return ! $ret;