@param $algorithm

@return bool
546706
public static function isSupportedSigningAlgorithm($algorithm)
    {
        return in_array(
            $algorithm,
            array(
                XMLSecurityKey::RSA_1_5,
                XMLSecurityKey::RSA_SHA1,
                XMLSecurityKey::RSA_SHA256,
                XMLSecurityKey::RSA_SHA384,
                XMLSecurityKey::RSA_SHA512
            )
        );
    }
442309
private function canKeyBeUsedWithAlgorithm($algorithm, JWKInterface $key)
    {
        if (null === $algorithm) {
            return 0;
        }
        if ($key->has('alg')) {
            return $algorithm === $key->get('alg') ? 1 : false;
        }

        return 0;
    }
701635
private static function calculateX509Fingerprint($pem, $algorithm, $binary = false)
    {
        $pem = preg_replace('#-.*-|\r|\n#', '', $pem);
        $bin = base64_decode($pem);

        return hash($algorithm, $bin, $binary);
    }
344509
private function isParameterisedMatch(array $route)
    {
        // Find out if the route has parameters
        if (!preg_match('/\{[a-z]+\}/i', $route['path'])) {
            return false;
        }

        $routePieces = explode('/', $route['path']);
        $urlPieces = explode('/', $this->path);
        if (count($routePieces) != count($urlPieces)) {
            return false;
        }

        $params = array();
        foreach ($routePieces as $routeKey => $routeValue) {
            if (preg_match('/\{[a-z]+\}/i', $routeValue, $matches)) {
                $paramName = trim($routeValue, '{} ');
                $params[$paramName] = urldecode($urlPieces[$routeKey]);
            } else {
                if ($routeValue != $urlPieces[$routeKey]) {
                    return false;
                }
            }
        }

        $route['params'] = array_merge_recursive($route['params'], $params);

        return $route;
    }
572316
public static function IsSingleDepth( array $array ) : bool
   {

      if ( \count( $array ) < 1 )
      {
         return false;
      }

      foreach ( $array as $v )
      {
         if ( \is_array( $v ) && \count( $v ) > 0 )
         {
            return false;
         }
      }

      return true;

   }
895726
public function hash(string $password, string $algorithm): string
    {
        return $this->passwordHashService->hash($password, $algorithm);
    }
90827
public function hasMethodCall($method)
    {
        foreach ($this->calls as $call) {
            if ($call[0] === $method) {
                return true;
            }
        }

        return false;
    }
399663
public function setAlgorithm($algorithm)
    {
        $algorithm = strtoupper($algorithm);

        if (Algorithm::validate($algorithm)) {
            $this->algorithm = $algorithm;
        }

        return $this;
    }
1126604
public boolean addAlgorithm(Algorithm algorithm) {
		if (algorithm == null || idsToAlgorithms.containsKey(algorithm.getId())) {
			return false;
		}

		idsToAlgorithms.put(algorithm.getId(), algorithm);
		algorithms = null;
		return true;
	}
967293
public function hasLinks($array) {
        if(is_array($array)) {
            foreach($array as $link) {
                if($this->hasLink($link) === false) {
                    return false;
                }
            }
            return true;
        }
        return false;
    }
567409
public function validateHmac(string $hmac, string $key, string $algorithm = 'sha256', bool $raw = false): bool
	{
		return hash_equals($hmac, $this->getHmac($key, $algorithm, $raw));
	}
275597
public static boolean isCfmxCompat(String algorithm) {

	if (StringUtil.isEmpty(algorithm, true)) return true;

	return algorithm.equalsIgnoreCase(CFMXCompat.ALGORITHM_NAME);
    }
277822
public function checkMethod($action): bool {
        $methods = $this->methods();
        return !isset($methods[$action]) ||
            in_array(app('request')->method(), $methods[$action]);
    }
117062
public function create(array $algorithms): JWSVerifier
    {
        $algorithmManager = $this->algorithmManagerFactory->create($algorithms);

        return new JWSVerifier($algorithmManager);
    }
1114021
public static function hash_init($algorithm)
    {
        if (in_array($algorithm, hash_algos())) {
            // use PHP hash()
            $res = hash_init($algorithm);
        }
        else {
            throw new RuntimeException("Unsupported hash algorithm '" . $algo . "'.");
        }

        //XXX should return Hasher class to keep track of key size
        return $res;
    }
1162044
public static function isAssociativeArray($array)
    {
        if (is_array($array)) {
            foreach (array_keys($array) as $k => $v) {
                if ($k !== $v) {
                    return true;
                }
            }
        }

        return false;
    }
366058
public static function has(array $array, string $key): bool
    {
        $check = self::dataByPath($array, $key, false, 'not.found');
        return $check !== 'not.found';
    }