uTools-Manuals/docs/php/mcrypt_decrypt.html
2019-04-28 19:00:34 +08:00

152 lines
5.3 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>使用给定参数解密密文</title>
</head>
<body class="docs"><div id="layout">
<div id="layout-content"><div id="function.mcrypt-decrypt" class="refentry">
<div class="refnamediv">
<h1 class="refname">mcrypt_decrypt</h1>
<p class="verinfo">(PHP 4 &gt;= 4.0.2, PHP 5, PHP 7 &lt; 7.2.0, PECL mcrypt &gt;= 1.0.0)</p><p class="refpurpose"><span class="refname">mcrypt_decrypt</span> &mdash; <span class="dc-title">使用给定参数解密密文</span></p>
</div>
<div id="function.mcrypt-decrypt-refsynopsisdiv">
<div class="warning"><strong class="warning">Warning</strong><p class="simpara">This function has been
<em class="emphasis">DEPRECATED</em> as of PHP 7.1.0 and
<em class="emphasis">REMOVED</em> as of PHP 7.2.0. Relying on this function
is highly discouraged.</p></div>
</div>
<div class="refsect1 description" id="refsect1-function.mcrypt-decrypt-description">
<h3 class="title">说明</h3>
<div class="methodsynopsis dc-description">
<span class="methodname"><strong>mcrypt_decrypt</strong></span>
( <span class="methodparam"><span class="type">string</span> <code class="parameter">$cipher</code></span>
, <span class="methodparam"><span class="type">string</span> <code class="parameter">$key</code></span>
, <span class="methodparam"><span class="type">string</span> <code class="parameter">$data</code></span>
, <span class="methodparam"><span class="type">string</span> <code class="parameter">$mode</code></span>
[, <span class="methodparam"><span class="type">string</span> <code class="parameter">$iv</code></span>
] ) : <span class="type">string</span></div>
<p class="para rdfs-comment">
解密 <code class="parameter">data</code> 并返回明文。
</p>
</div>
<div class="refsect1 parameters" id="refsect1-function.mcrypt-decrypt-parameters">
<h3 class="title">参数</h3>
<p class="para">
<dl>
<dt>
<code class="parameter">cipher</code></dt>
<dd>
<p class="para"><strong><code>MCRYPT_ciphername</code></strong> 常量中的一个,或者是字符串值的算法名称。</p>
</dd>
<dt>
<code class="parameter">key</code></dt>
<dd>
<p class="para">
数据加密密钥。
如果密钥长度不是加解密算法能够支持的有效长度,
那么会产生警告并且返回 <strong><code>FALSE</code></strong>
</p>
</dd>
<dt>
<code class="parameter">data</code></dt>
<dd>
<p class="para">
要使用给定的 <code class="parameter">cipher</code>
<code class="parameter">mode</code> 解密的数据。
如果数据大小不是 n * 分组大小,则在其后追加 &#039;<em>\0</em>&#039; 来补齐。
</p>
</dd>
<dt>
<code class="parameter">mode</code></dt>
<dd>
<p class="para"><strong><code>MCRYPT_MODE_modename</code></strong> 常量中的一个,或以下字符串中的一个:&quot;ecb&quot;&quot;cbc&quot;&quot;cfb&quot;&quot;ofb&quot;&quot;nofb&quot;&quot;stream&quot;</p>
</dd>
<dt>
<code class="parameter">iv</code></dt>
<dd>
<p class="para">Used for the initialization in CBC, CFB, OFB modes, and in some algorithms in STREAM mode. If the provided IV size is not supported by the chaining mode or no IV was provided, but the chaining mode requires one, the function will emit a warning and return <strong><code>FALSE</code></strong>.</p>
</dd>
</dl>
</p>
</div>
<div class="refsect1 returnvalues" id="refsect1-function.mcrypt-decrypt-returnvalues">
<h3 class="title">返回值</h3>
<p class="para">
以字符串格式返回解密后的数据, 或者在失败时返回 <strong><code>FALSE</code></strong>
</p>
</div>
<div class="refsect1 changelog" id="refsect1-function.mcrypt-decrypt-changelog">
<h3 class="title">更新日志</h3>
<p class="para">
<table class="doctable informaltable">
<thead>
<tr>
<th>版本</th>
<th>说明</th>
</tr>
</thead>
<tbody class="tbody">
<tr>
<td>5.6.0</td>
<td>
不再接受无效长度的 <code class="parameter">key</code> and <code class="parameter">iv</code> 参数。
如果参数长度无效,则 <span class="function"><strong>mcrypt_decrypt()</strong></span> 函数会产生警告并且返回 <strong><code>FALSE</code></strong>
之前版本中,对于长度不足的密钥和初始向量会在其后补齐 &#039;<em>\0</em>&#039;
使其达到有效长度。
</td>
</tr>
</tbody>
</table>
</p>
</div>
<div class="refsect1 seealso" id="refsect1-function.mcrypt-decrypt-seealso">
<h3 class="title">参见</h3>
<p class="para">
<ul class="simplelist">
<li class="member"><span class="function"><a href="mcrypt_encrypt.html" class="function" rel="rdfs-seeAlso">mcrypt_encrypt()</a> - 使用给定参数加密明文</span></li>
</ul>
</p>
</div>
</div></div></div></body></html>