/** * @see VerifyInterface::init */ public function init($algorithm, $path) { $algorithm = strtolower(preg_replace('/[^A-Za-z0-9]+/', '', $algorithm)); if (false === ($this->context = @hash_init($algorithm))) { $this->context = null; throw SignatureException::lastError(); } }
/** * Selects the appropriate hashing class. */ public function __construct() { if (extension_loaded('openssl')) { $this->hash = new OpenSsl(); } elseif (class_exists('Crypt_RSA')) { $this->hash = new PhpSeclib(); } else { throw SignatureException::create('The "openssl" extension and "phpseclib" libraries are not available.'); } }