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

134 lines
5.4 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.hash-final" class="refentry">
<div class="refnamediv">
<h1 class="refname">hash_final</h1>
<p class="verinfo">(PHP 5 &gt;= 5.1.2, PHP 7, PECL hash &gt;= 1.1)</p><p class="refpurpose"><span class="refname">hash_final</span> &mdash; <span class="dc-title">结束增量哈希,并且返回摘要结果</span></p>
</div>
<div class="refsect1 description" id="refsect1-function.hash-final-description">
<h3 class="title">说明</h3>
<div class="methodsynopsis dc-description">
<span class="methodname"><strong>hash_final</strong></span>
( <span class="methodparam"><span class="type"><span class="type HashContext">HashContext</span></span> <code class="parameter">$context</code></span>
[, <span class="methodparam"><span class="type">bool</span> <code class="parameter">$raw_output</code><span class="initializer"> = <strong><code>FALSE</code></strong></span></span>
] ) : <span class="type">string</span></div>
</div>
<div class="refsect1 parameters" id="refsect1-function.hash-final-parameters">
<h3 class="title">参数</h3>
<p class="para">
<dl>
<dt>
<code class="parameter">context</code></dt>
<dd>
<p class="para">
<span class="function"><a href="hash_init.html" class="function">hash_init()</a></span> 函数返回的哈希运算上下文资源。
</p>
</dd>
<dt>
<code class="parameter">raw_output</code></dt>
<dd>
<p class="para">
设置为 <strong><code>TRUE</code></strong>,输出格式为原始的二进制数据。
设置为 <strong><code>FALSE</code></strong>,输出小写的 16 进制字符串。
</p>
</dd>
</dl>
</p>
</div>
<div class="refsect1 returnvalues" id="refsect1-function.hash-final-returnvalues">
<h3 class="title">返回值</h3>
<p class="para">
如果 <code class="parameter">raw_output</code> 设置为 <strong><code>TRUE</code></strong> 则返回原始二进制数据表示的信息摘要,
否则返回 16 进制小写字符串格式表示的信息摘要。
</p>
</div>
<div class="refsect1 changelog" id="refsect1-function.hash-final-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>7.2.0</td>
<td>
接收参数从资源类型修改为 <strong class="classname">HashContext</strong> 对象类型。
</td>
</tr>
</tbody>
</table>
</p>
</div>
<div class="refsect1 examples" id="refsect1-function.hash-final-examples">
<h3 class="title">范例</h3>
<p class="para">
<div class="example" id="example-892">
<p><strong>Example #1 <span class="function"><strong>hash_final()</strong></span> 例程</strong></p>
<div class="example-contents">
<div class="phpcode"><pre><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />$ctx&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">hash_init</span><span style="color: #007700">(</span><span style="color: #DD0000">'sha1'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">hash_update</span><span style="color: #007700">(</span><span style="color: #0000BB">$ctx</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'The&nbsp;quick&nbsp;brown&nbsp;fox&nbsp;jumped&nbsp;over&nbsp;the&nbsp;lazy&nbsp;dog.'</span><span style="color: #007700">);<br />echo&nbsp;</span><span style="color: #0000BB">hash_final</span><span style="color: #007700">(</span><span style="color: #0000BB">$ctx</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</pre></div>
</div>
<div class="example-contents"><p>以上例程会输出:</p></div>
<div class="example-contents screen">
<div class="cdata"><pre>
c0854fb9fb03c41cce3802cb0d220529e6eef94e
</pre></div>
</div>
</div>
</p>
</div>
<div class="refsect1 seealso" id="refsect1-function.hash-final-seealso">
<h3 class="title">参见</h3>
<p class="para">
<ul class="simplelist">
<li class="member"><span class="function"><a href="hash_init.html" class="function" rel="rdfs-seeAlso">hash_init()</a> - 初始化增量哈希运算上下文</span></li>
<li class="member"><span class="function"><a href="hash_update.html" class="function" rel="rdfs-seeAlso">hash_update()</a> - 向活跃的哈希运算上下文中填充数据</span></li>
<li class="member"><span class="function"><a href="hash_update_stream.html" class="function" rel="rdfs-seeAlso">hash_update_stream()</a> - 从打开的流向活跃的哈希运算上下文中填充数据</span></li>
<li class="member"><span class="function"><a href="hash_update_file.html" class="function" rel="rdfs-seeAlso">hash_update_file()</a> - 从文件向活跃的哈希运算上下文中填充数据</span></li>
</ul>
</p>
</div>
</div></div></div></body></html>