public function setHashAlgorithm(string $algorithm): void
    {
        $knownAlgorithms = openssl_get_md_methods(true);

        if (!in_array($algorithm, $knownAlgorithms)) {
            $errorMessage = "The hash algorithm \"$algorithm\" is unknown." .
                'For a list of valid algorithms, see openssl_get_md_methods(true).';
            throw new UnableToHashException($errorMessage);
        }

        $this->hashAlgorithm = $algorithm;
    }
public function setHashAlgorithm(string $algorithm): void
    {
        $knownAlgorithms = openssl_get_md_methods(true);

        if (!in_array($algorithm, $knownAlgorithms)) {
            $errorMessage = "The hash algorithm \"$algorithm\" is unknown." .
                'For a list of valid algorithms, see openssl_get_md_methods(true).';
            throw new UnableToHashException($errorMessage);
        }

        $this->hashAlgorithm = $algorithm;
    }
public function setHashAlgorithm ( string $ algorithm ) : void { $ knownAlgorithms = openssl_get_md_methods ( true ) ; if ( ! in_array ( $ algorithm , $ knownAlgorithms ) ) { $ errorMessage = "The hash algorithm \"$algorithm\" is unknown." . 'For a list of valid algorithms, see openssl_get_md_methods(true).' ; throw new UnableToHashException ( $ errorMessage ) ; } $ this -> hashAlgorithm = $ algorithm ; }
Sets the hashing algorithm

To get a list of valid algorithms, see openssl_get_md_methods(true)

@throws UnableToHashException
@param string $algorithm For a list of valid algorithms, see openssl_get_md_methods(true).
@return void
Sets the hashing algorithm