public function setAlgorithm($algorithm)
    {
        if (!in_array($algorithm, $this->allowedAlgorithms)) {
            throw new \InvalidArgumentException('Not an allowed algorithm: ' . $algorithm);
        }
        
        $this->algorithm = $algorithm;
        
        return $this;
    }
public function setAlgorithm($algorithm)
    {
        if (!in_array($algorithm, $this->allowedAlgorithms)) {
            throw new \InvalidArgumentException('Not an allowed algorithm: ' . $algorithm);
        }
        
        $this->algorithm = $algorithm;
        
        return $this;
    }
public function setAlgorithm ( $ algorithm ) { if ( ! in_array ( $ algorithm , $ this -> allowedAlgorithms ) ) { throw new \ InvalidArgumentException ( 'Not an allowed algorithm: ' . $ algorithm ) ; } $ this -> algorithm = $ algorithm ; return $ this ; }
Changing the used algorithm for hashing

Can only be one of the algorithms in the allowedAlgorithms property.

@param string $algorithm
@throws \InvalidArgumentException
@return \Otp\Otp
Changing the used algorithm for hashing