@param $encryptedToken

@return string
164740
public function decrypt($encryptedToken)
    {
        $decryptedToken = rtrim(mcrypt_decrypt(MCRYPT_RIJNDAEL_256, md5($this->key), base64_decode(urldecode($encryptedToken)), MCRYPT_MODE_CBC, md5(md5($this->key))), "\0");

        if (false === $decryptedToken ) {
            throw new \InvalidArgumentException('Invalid decrypted token. Check the encryption key');
        }

        return $decryptedToken;
    }
125306
protected function getToken($requestToken)
    {
        $prefix = $this->options['token_prefix'];
        if (null === $prefix) {
            return $requestToken;
        }

        if (null === $requestToken) {
            return $requestToken;
        }

        $requestToken = trim(str_replace($prefix, "", $requestToken));

        return $requestToken;
    }
155834
public function decrypt(string $encrypted): string {
        $status = openssl_public_decrypt($encrypted, $decrypted, $this);
        if(!$status) {
            throw new RuntimeException('Decrypt failed');
        }
        return $decrypted;
    }
1285544
public function encrypt(string $decrypted): string {
        $status = openssl_private_encrypt($decrypted, $encrypted, $this);
        if(!$status) {
            throw new RuntimeException('Encrypt failed');
        }
        return $encrypted;
    }
1143769
public function encrypt(string $data): string
    {
        try {
            return Crypto::encrypt($data, $this->key);
        } catch(EnvironmentIsBrokenException $e) {
            throw new CryptoException($e->getMessage(), $e->getCode(), $e);
        }
    }
491354
private function encryptMailText(array $matches): string
    {
        $email = $matches[1];

        return $this->getSecuredName($email).
            $this->mailAtText[array_rand($this->mailAtText)].
            $this->getSecuredName($email, true);
    }
712407
private function decrypt($encrypted) {
		$this->key = base64_decode($this->manager->app->aeskey . '=');

		//使用BASE64对需要解密的字符串进行解码
		$ciphertext_dec = base64_decode($encrypted);
		$module = mcrypt_module_open(MCRYPT_RIJNDAEL_128, '', MCRYPT_MODE_CBC, '');
		$iv = substr($this->key, 0, 16);
		mcrypt_generic_init($module, $this->key, $iv);

		//解密
		$decrypted = mdecrypt_generic($module, $ciphertext_dec);
		mcrypt_generic_deinit($module);
		mcrypt_module_close($module);

		//去除补位字符
		$result = $this->decode($decrypted);

		//去除16位随机字符串,网络字节序和AppId
		if(strlen($result) < 16) {
			return false;
		}

		$content = substr($result, 16, strlen($result));
		$len_list = unpack('N', substr($content, 0, 4));
		$xml_len = $len_list[1];
		$xml_content = substr($content, 4, $xml_len);
		$from_appid = substr($content, $xml_len + 4);

		return $from_appid == $this->manager->app->appid ? $xml_content : false;
	}
1126025
public function getEncryptedValue($value): string
    {
        return strtoupper(
            hash_hmac(static::HASH_TYPE, $value, $this->config->getHmacPassword())
        );
    }
1013486
public function decryptCardCode($encrypt_code) {
        $data = array(
            'encrypt_code' => $encrypt_code,
        );
        if (!$this->access_token && !$this->checkAuth()) return false;
        $result = $this->http_post(self::API_BASE_URL_PREFIX . self::CARD_CODE_DECRYPT . 'access_token=' . $this->access_token, self::json_encode($data));
        if ($result) {
            $json = json_decode($result, true);
            if (!$json || !empty($json['errcode'])) {
                $this->errCode = $json['errcode'];
                $this->errMsg  = $json['errmsg'];
                return false;
            }
            return $json;
        }
        return false;
    }
72236
static function cryptoJsAesDecrypt($passphrase, $jsonString){
		$jsondata = json_decode($jsonString, true);
		try {
			$salt = hex2bin($jsondata["s"]);
			$iv  = hex2bin($jsondata["iv"]);
		} catch(\Exception $e) { return null; }
		$ct = base64_decode($jsondata["ct"]);
		$concatedPassphrase = $passphrase.$salt;
		$md5 = array();
		$md5[0] = md5($concatedPassphrase, true);
		$result = $md5[0];
		for ($i = 1; $i < 3; $i++) {
			$md5[$i] = md5($md5[$i - 1].$concatedPassphrase, true);
			$result .= $md5[$i];
		}
		$key = substr($result, 0, 32);
		$data = openssl_decrypt($ct, 'aes-256-cbc', $key, true, $iv);
		return json_decode($data, true);
	}
48103
public String decrypt(String encrytedText) {
        Objects.requireNonNull(encrytedText, Required.ENCRYPTED_TEXT.toString());
        return decrypt(encrytedText, getSizedSecret(this.config.getApplicationSecret()));
    }
1098183
function decrypt($ciphertext)
    {
        if ($this->k <= 0) {
            return false;
        }

        $ciphertext = str_split($ciphertext, $this->k);
        $ciphertext[count($ciphertext) - 1] = str_pad($ciphertext[count($ciphertext) - 1], $this->k, chr(0), STR_PAD_LEFT);

        $plaintext = '';

        switch ($this->encryptionMode) {
            case CRYPT_RSA_ENCRYPTION_NONE:
                $decrypt = '_raw_encrypt';
                break;
            case CRYPT_RSA_ENCRYPTION_PKCS1:
                $decrypt = '_rsaes_pkcs1_v1_5_decrypt';
                break;
            //case CRYPT_RSA_ENCRYPTION_OAEP:
            default:
                $decrypt = '_rsaes_oaep_decrypt';
        }

        foreach ($ciphertext as $c) {
            $temp = $this->$decrypt($c);
            if ($temp === false) {
                return false;
            }
            $plaintext.= $temp;
        }

        return $plaintext;
    }
545245
public function decrypt($crypttext, $key = null) {
        if(null !== $key) {
            $this->_key = md5($key);
        }

        $crypttext = base64_decode($crypttext);
        $plaintext = '';
        $td        = mcrypt_module_open($this->_cypher, '', self::MODE, '');
        $ivsize    = mcrypt_enc_get_iv_size($td);
        $iv        = substr($crypttext, 0, $ivsize);
        $crypttext = substr($crypttext, $ivsize);
        if ($iv) {
            mcrypt_generic_init($td, $this->_key, $iv);
            $plaintext = mdecrypt_generic($td, $crypttext);
        }
        return trim($plaintext);
    }
945992
public function encrypt($data)
    {
        $nonce = random_bytes(SODIUM_CRYPTO_SECRETBOX_NONCEBYTES);
        $token = base64_encode($nonce.sodium_crypto_secretbox($data, $nonce, $this->key).'&&'.$this->key);

        return $token;
    }
1078683
public function getEncryptExpression($text, $encryptionKey, $quote = true)
    {
        $quotedText = $quote ? DB::connection()->getPdo()->quote($text) : $text;
        $quotedEncryptKey = DB::connection()->getPdo()->quote($encryptionKey);
        return "pgp_sym_encrypt($quotedText, $quotedEncryptKey)";
    }
469944
public function encrypt($input)
    {
        if (! $input) {
            return $input;
        }

        $methods = $this->getEncryptionMethods();
        $method  = reset($methods);
        $mkey    = key($methods);

        if ('mcrypt' == $method) {
            $result = $this->encryptMcrypt($input);
        } elseif ('null' == $method) {
            $result = $input;
        } else {
            $result = $this->encryptOpenSsl($input, $method);
        }

        return ":$mkey:" . base64_encode($result);
    }
1220947
function randomToken () {
  return crypto.randomBytes(20).toString('base64').replace(/\//g, '-').replace(/\+/g, '_').replace(/=/g, '');
}