@param bool|null $sandbox

@return WSCryptDecrypt
166801
public static function create(?bool $sandbox = false)
    {
        $soapClient = new WSCryptDecryptSoapClient($sandbox);

        return new WSCryptDecrypt($soapClient->getSoapClient());
    }
72745
function _createSandbox(config) {
  if (proxiedGlobal && proxiedGlobal) return workspaces.get(...makeArray(config.workspace));

  const sandbox = {};
  if (config.includeGlobals && (!proxiedGlobal || !config.proxyGlobal)) Object.assign(sandbox, global);

  return vm.createContext(sandbox);
}
684305
public static function altEncrypt($str, $pass = '')
    {
        /**
         * if empty values return null
         */
        if (!$str) {
            return null;
        }

        /**
         * ------------------------------------
         * Safe Sanitized hash
         * ------------------------------------
         */
        (is_null($pass) || $pass === false) && $pass = '';
        // safe is use array or object as hash
        $pass = Util::maybeSerialize($pass);
        if (!$pass) {
            $pass = sha1($pass);
        }

        // make an array values -> use key acb
        $str = serialize(array('acb' => $str));
        // rotate 13
        $str = pack('a*', Util::rotate($str.sha1(sha256::hash($pass)), 13));

        /**
         * Doing safe encode base 64
         */
        $str = Util::safeBase64Encode($str);

        /**
         * ------------------------------------
         * Doing convert string
         * ------------------------------------
         */
        $str_arr  = str_split($str);
        $add = 0;
        $div = strlen($str) / strlen($pass);
        $new_pass = '';
        while ($add <= $div) {
            $new_pass .= $pass;
            $add++;
        }
        $pass_arr = str_split($new_pass);
        $ascii = '';
        foreach ($str_arr as $key => $asc) {
            $pass_int = ord($pass_arr[$key]);
            $str_int = ord($asc);
            $int_add = $str_int + $pass_int;
            $ascii .= chr(($int_add+strlen($str)));
        }
        $ascii = trim(Util::safeBase64Encode($ascii));

        /**
         * ------------------------------------
         * Inject Result of with sign
         * ------------------------------------
         */
        if (strlen($ascii) > 10) {
            return substr_replace($ascii, '_aCb=', 10, 0);
        } else {
            return substr_replace($ascii, '_aCb=', 2, 0);
        }
    }
1020885
def sandbox():
        """"""
        def fget(self):
            return self._options.get('sandbox', None)

        def fset(self, value):
            self._options['sandbox'] = value

        return locals()
912096
public function setSandboxMode($isSandbox = true)
    {
        if (true === $isSandbox) {
            $this->data['settings']['mode'] = 'sandbox';
        } else {
            unset($this->data['settings']['mode']);
        }

        return $this;
    }
1355447
public static function encryptWithPassword(
        string $plaintext,
        string $password,
        string $ad = '',
        string $format = null
    ): string {
        return self::encrypt($plaintext, $password, $ad, $format, true);
    }
408003
public function handle(Container $app, Sandbox $sandbox)
    {
        if ($sandbox->isLaravel()) {
            $router = $app->make('router');
            $request = $sandbox->getRequest();
            $closure = function () use ($app, $request) {
                $this->container = $app;
                if (is_null($request)) {
                    return;
                }
                try {
                    /** @var mixed $route */
                    $route = $this->routes->match($request);
                    // clear resolved controller
                    if (property_exists($route, 'container')) {
                        $route->controller = null;
                    }
                    // rebind matched route's container
                    $route->setContainer($app);
                } catch (NotFoundHttpException $e) {
                    // do nothing
                }
            };

            $resetRouter = $closure->bindTo($router, $router);
            $resetRouter();
        } else {
            // lumen router only exists after lumen 5.5
            if (property_exists($app, 'router')) {
                $app->router->app = $app;
            }
        }

        return $app;
    }
564441
public function encrypt($value, $raw_binary = false)
    {
        return Crypto::encryptWithPassword($value, $this->secret, $raw_binary);
    }
1170187
public static function getBox($box)
    {
        return isset(self::$data[$box]) ? self::$data[$box] : null;
    }
490493
public static function encrypt($input, $secret = null) {
        // no input?
        if(!$input)
            return false;

        // encrypt
        $encrypted = Security::encrypt((string)$input, md5(self::secret($secret)));

        // output
        return self::base64encode($encrypted);
    }
1339656
CipherBox newReadCipher() throws NoSuchAlgorithmException {
        BulkCipher cipher = cipherSuite.cipher;
        CipherBox box;
        if (isClient) {
            box = cipher.newCipher(protocolVersion, svrWriteKey, svrWriteIV,
                                   sslContext.getSecureRandom(), false);
            svrWriteKey = null;
            svrWriteIV = null;
        } else {
            box = cipher.newCipher(protocolVersion, clntWriteKey, clntWriteIV,
                                   sslContext.getSecureRandom(), false);
            clntWriteKey = null;
            clntWriteIV = null;
        }
        return box;
    }
918533
public static function add($key, $value = null, $seconds = 0, $encrypt = false, $path = null, $domain = null, $secure = null, $httponly = null) {

		if(false === is_string($key)) {
			return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($key)), E_USER_ERROR);
		}

		if(null !== $value && false === is_string($value)) {
			return trigger_error(sprintf('Argument 2 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($value)), E_USER_ERROR);
		}

		if(null !== $seconds && false === ('-' . intval($seconds) == '-' . $seconds)) {
			return trigger_error(sprintf('Argument 3 passed to %s() must be of the type integer, "%s" given', __METHOD__, gettype($seconds)), E_USER_ERROR);
		}

		if(null !== $encrypt && false === is_bool($encrypt)) {
			return trigger_error(sprintf('Argument 4 passed to %s() must be of the type boolean, "%s" given', __METHOD__, gettype($encrypt)), E_USER_ERROR);
		}

		if(null !== $path && false === is_string($path)) {
			return trigger_error(sprintf('Argument 5 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($path)), E_USER_ERROR);
		}

		if(null !== $domain && false === is_string($domain)) {
			return trigger_error(sprintf('Argument 6 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($domain)), E_USER_ERROR);
		}

		if(null !== $secure && false === is_bool($secure)) {
			return trigger_error(sprintf('Argument 7 passed to %s() must be of the type boolean, "%s" given', __METHOD__, gettype($secure)), E_USER_ERROR);
		}

		if(null !== $httponly && false === is_bool($httponly)) {
			return trigger_error(sprintf('Argument 8 passed to %s() must be of the type boolean, "%s" given', __METHOD__, gettype($httponly)), E_USER_ERROR);
		}

		$cookie = session_get_cookie_params(); 

		if(true === $encrypt) {

			if(null === Application :: get('salt')) {
				return trigger_error('You should specify a salt (string) in the Application config before encrypting Cookies', E_USER_ERROR);
			}

			$key 	= rtrim(base64_encode($key), '=');
			$value 	= base64_encode(Hash :: encrypt($value, Application :: get('salt')));
		}

		setcookie($key, $value, time() + $seconds, ($path || $cookie['path']), ($domain || $cookie['domain']), ($secure || $cookie['secure']), ($httponly || $cookie['httponly']));
	}
838748
public static function eat($namespace)
	{
		$hash  = \App::hash(\App::get('client')->name . ':' . $namespace);

		$key = \App::hash('');
		$crypt = new \Hubzero\Encryption\Encrypter(
			new \Hubzero\Encryption\Cipher\Simple,
			new \Hubzero\Encryption\Key('simple', $key, $key)
		);

		if ($str = \App::get('request')->getString($hash, '', 'cookie'))
		{
			$sstr   = $crypt->decrypt($str);
			$cookie = @unserialize($sstr);

			return (object)$cookie;
		}

		return false;
	}
1058454
function ntPasswordHash($password = null)
    {
        if (isset($password)) {
            return pack('H*',hash('md4', $this->str2unicode($password)));
        } else {
            return pack('H*',hash('md4', $this->str2unicode($this->password)));
        }
    }
777230
public static function encryptOpenssl($textToEncrypt, string $secretHash = null, string $password = ''): ? string
  {
    if ( !$secretHash ){
      $secretHash = self::$salt;
    }
    if ( $length = openssl_cipher_iv_length(self::$method) ){
      $iv = substr(md5(self::$prefix.$password), 0, $length);
      return openssl_encrypt($textToEncrypt, self::$method, $secretHash, true, $iv);
    }
    return null;
  }
132712
public function encrypt($str = null, $key = null)
    {
        if (!is_null($key)) {
            $this->setSalt($key);
        }
        srand((double)microtime()*1000000);
        $key_encrypt    = md5(rand(0,32000));
        $count          = 0;
        $tmp            = '';
        for ($ctr=0;$ctr<strlen($str);$ctr++) {
            if ($count==strlen($key_encrypt)) {
                $count=0;
            }
            $tmp.= substr($key_encrypt,$count,1).(substr($str,$ctr,1) ^ substr($key_encrypt,$count,1) );
            $count++;
        }
        return base64_encode(self::getEncryptionKey($tmp));
    }
1119711
public static function fromArray($input = null)
    {
        //====================================================================//
        // Safety Check
        if (is_null($input) || !self::isValid($input)) {
            return null;
        }
        //====================================================================//
        // return Encoded CheckSum
        return self::getEncoded($input);
    }