示例#1
0
文件: Hash.php 项目: dlugos/box2-lib
 /**
  * @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();
     }
 }
示例#2
0
 /**
  * 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.');
     }
 }