keepassphp/util/cipher.php
private function load()
	{
		if(strlen($this->_method) == 0 || strlen($this->_key) == 0)
			return null;
		$m = mcrypt_module_open($this->_type, '', $this->_mode, '');
		if($m === false)
			return null;
		// This check is performed by mcrypt_generic_init, but it's better
		// to do it now, because mcrypt_generic_init does not return a
		// negative or false value if it fails.
		$ivsize = mcrypt_enc_get_iv_size($m);
		if(strlen($this->_iv) != $ivsize)
		{
			// In ECB (and some other modes), the IV is not used but still
			// required to have the this size by mcrypt_generic_init, so
			// let's make a fake one.
			if(strtolower($this->_mode) == "ecb")
				$ivsize = str_repeat("\0", $ivsize);
			else
				return null;
		}
		$r = @mcrypt_generic_init($m, $this->_key, $this->_iv);
		if($r < 0 || $r === false)
			return null;
		return $m;
	}
private function load()
	{
		if(strlen($this->_method) == 0 || strlen($this->_key) == 0)
			return null;
		$m = mcrypt_module_open($this->_type, '', $this->_mode, '');
		if($m === false)
			return null;
		// This check is performed by mcrypt_generic_init, but it's better
		// to do it now, because mcrypt_generic_init does not return a
		// negative or false value if it fails.
		$ivsize = mcrypt_enc_get_iv_size($m);
		if(strlen($this->_iv) != $ivsize)
		{
			// In ECB (and some other modes), the IV is not used but still
			// required to have the this size by mcrypt_generic_init, so
			// let's make a fake one.
			if(strtolower($this->_mode) == "ecb")
				$ivsize = str_repeat("\0", $ivsize);
			else
				return null;
		}
		$r = @mcrypt_generic_init($m, $this->_key, $this->_iv);
		if($r < 0 || $r === false)
			return null;
		return $m;
	}
private function load ( ) { if ( strlen ( $ this -> _method ) == 0 || strlen ( $ this -> _key ) == 0 ) return null ; $ m = mcrypt_module_open ( $ this -> _type , '' , $ this -> _mode , '' ) ; if ( $ m === false ) return null ; // This check is performed by mcrypt_generic_init, but it's better
 // to do it now, because mcrypt_generic_init does not return a
 // negative or false value if it fails.
 $ ivsize = mcrypt_enc_get_iv_size ( $ m ) ; if ( strlen ( $ this -> _iv ) != $ ivsize ) { // In ECB (and some other modes), the IV is not used but still
 // required to have the this size by mcrypt_generic_init, so
 // let's make a fake one.
 if ( strtolower ( $ this -> _mode ) == "ecb" ) $ ivsize = str_repeat ( "\0" , $ ivsize ) ; else return null ; } $ r = @ mcrypt_generic_init ( $ m , $ this -> _key , $ this -> _iv ) ; if ( $ r < 0 || $ r === false ) return null ; return $ m ; }
Opens a mcrypt module.
@return A mcrypt module resource, or null if an error occurred.
Opens a mcrypt module .