1
0
mirror of https://github.com/php/doc-zh.git synced 2026-03-24 07:02:15 +01:00
Files
archived-doc-zh/reference/hash/book.xml
2025-10-20 01:21:56 +08:00

82 lines
3.2 KiB
XML
Raw Permalink 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.
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- EN-Revision: a19139232af73a3c2054fcf5a687640ade63a393 Maintainer: ichenshy Status: ready -->
<!-- CREDITS: mowangjuanzi -->
<book xml:id="book.hash" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" annotations="interactive">
<?phpdoc extension-membership="core" ?>
<title>散列消息摘要框架</title>
<titleabbrev>Hash</titleabbrev>
<!-- {{{ preface -->
<preface xml:id="intro.hash">
&reftitle.intro;
<para>
该扩展提供了一些函数,可用于使用多种散列算法对任意长度的消息进行直接或增量处理,包括生成
<acronym>HMAC</acronym> 值以及包括 <acronym>HKDF</acronym>
<acronym>PBKDF2</acronym> 在内的密钥派生。
</para>
<para>
散列算法大致分为三类,完整算法列表可在 <function>hash_algos</function> 的文档中找到。
<itemizedlist>
<listitem>
<simpara>
校验和算法(例如 <literal>"crc32b"</literal><literal>"adler32"</literal>):用于计算校验和,适用于检测传输错误等场景。这类算法通常速度非常快。但其生成的值往往容易被“猜测”或操纵以制造冲突,因此完全不适合用于加密用途。
</simpara>
</listitem>
<listitem>
<simpara>
非加密算法(例如 xxHash 系列):这些算法通常用于计算散列表的散列值,因为它们旨在为任意字符串输入提供良好的分布性。这些算法通常速度较快,但同样不适合用于加密用途。
</simpara>
</listitem>
<listitem>
<simpara>
加密算法(例如 SHA-2 系列):这些算法旨在生成能够反映输入特征但不可猜测且不易发生冲突的散列值。性能通常是次要考虑因素,但现代硬件通常对这些算法提供专门支持,在可用时 PHP 会尝试利用这些支持。
</simpara>
<simpara>
NIST美国国家标准与技术研究院的计算机安全资源中心提供了<link xlink:href="&url.hash.nist-hash-functions;">关于美国联邦信息处理标准当前批准算法的说明</link>
</simpara>
<caution>
<para>
一些早期的加密算法,例如 <literal>"md4"</literal><literal>"md5"</literal>
<literal>"sha1"</literal>,已证明容易受到碰撞攻击,通常建议不再将其用于加密应用。
</para>
</caution>
</listitem>
</itemizedlist>
</para>
<para>
另请参阅<link linkend="faq.passwords">关于安全密码散列的常见问题解答</link>,以获取在处理密码时使用散列函数的最佳实践信息。
</para>
</preface>
<!-- }}} -->
&reference.hash.setup;
&reference.hash.constants;
&reference.hash.hashcontext;
&reference.hash.reference;
</book>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->