private static function hash_compare($a, $b) {
    if (!is_string($a) || !is_string($b)) {
      return FALSE;
    }

    $len = strlen($a);
    if ($len !== strlen($b)) {
      return FALSE;
    }

    $status = 0;
    for ($i = 0; $i < $len; $i++) {
      $status |= ord($a[$i]) ^ ord($b[$i]);
    }
    return $status === 0;
  }
private static function hash_compare($a, $b) {
    if (!is_string($a) || !is_string($b)) {
      return FALSE;
    }

    $len = strlen($a);
    if ($len !== strlen($b)) {
      return FALSE;
    }

    $status = 0;
    for ($i = 0; $i < $len; $i++) {
      $status |= ord($a[$i]) ^ ord($b[$i]);
    }
    return $status === 0;
  }
private static function hash_compare ( $ a , $ b ) { if ( ! is_string ( $ a ) || ! is_string ( $ b ) ) { return FALSE ; } $ len = strlen ( $ a ) ; if ( $ len !== strlen ( $ b ) ) { return FALSE ; } $ status = 0 ; for ( $ i = 0 ; $ i < $ len ; $ i ++ ) { $ status |= ord ( $ a [ $ i ] ) ^ ord ( $ b [ $ i ] ) ; } return $ status === 0 ; }
Comparison function which resists timing attacks.

@param string $a
@param string $b
@return bool
Comparison function which resists timing attacks .