= 1) { $size = $size / 1024; ++$i; } return number_format($size, ($i ? 2 : 0), '.', ' ') . ' ' . I18n::_($iec[$i]); } /** * fixed time string comparison operation to prevent timing attacks * https://crackstation.net/hashing-security.htm?=rd#slowequals * can be replaced with hash_equals() after we drop PHP 5.5 support * * @access public * @static * @param string $a * @param string $b * @return bool */ public static function slowEquals($a, $b) { $diff = strlen($a) ^ strlen($b); for ($i = 0; $i < strlen($a) && $i < strlen($b); ++$i) { $diff |= ord($a[$i]) ^ ord($b[$i]); } return $diff === 0; } }