mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-15 16:38:54 +00:00
Document hash extension
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@202111 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
96bd406a66
commit
fd290bcfc3
12 changed files with 1204 additions and 0 deletions
42
reference/hash/constants.xml
Normal file
42
reference/hash/constants.xml
Normal file
|
@ -0,0 +1,42 @@
|
|||
<?xml version='1.0' encoding='iso-8859-1'?>
|
||||
<!-- $Revision: 1.1 $ -->
|
||||
<section id="hash.constants">
|
||||
&reftitle.constants;
|
||||
&extension.constants;
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<constant>HASH_HMAC</constant>
|
||||
(<type>integer</type>)
|
||||
</term>
|
||||
<listitem>
|
||||
<simpara>
|
||||
Optional flag for <function>hash_init</function>.
|
||||
Indicates that the HMAC digest-keying algorithm should be
|
||||
applied to the current hashing context.
|
||||
</simpara>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</section>
|
||||
|
||||
<!-- 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:"../../../../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
|
||||
-->
|
108
reference/hash/functions/hash-algos.xml
Normal file
108
reference/hash/functions/hash-algos.xml
Normal file
|
@ -0,0 +1,108 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1 $ -->
|
||||
<refentry id="function.hash-algos">
|
||||
<refnamediv>
|
||||
<refname>hash_algos</refname>
|
||||
<refpurpose>Return a list of registered hashing algorithms</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>array</type><methodname>hash_algos</methodname>
|
||||
<void/>
|
||||
</methodsynopsis>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
Returns a numerically indexed array containing the list of supported
|
||||
hashing algorithms.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title><function>hash_algos</function></title>
|
||||
<para>
|
||||
As of PHP 5.1.2, <function>hash_algos</function> will return the
|
||||
following list of algorithm names.
|
||||
</para>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
print_r(hash_algos());
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
&example.outputs;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
Array
|
||||
(
|
||||
[0] => md4
|
||||
[1] => md5
|
||||
[2] => sha1
|
||||
[3] => sha256
|
||||
[4] => sha384
|
||||
[5] => sha512
|
||||
[6] => ripemd128
|
||||
[7] => ripemd160
|
||||
[8] => whirlpool
|
||||
[9] => tiger128,3
|
||||
[10] => tiger160,3
|
||||
[11] => tiger192,3
|
||||
[12] => tiger128,4
|
||||
[13] => tiger160,4
|
||||
[14] => tiger192,4
|
||||
[15] => snefru
|
||||
[16] => gost
|
||||
[17] => adler32
|
||||
[18] => crc32
|
||||
[19] => crc32b
|
||||
[20] => haval128,3
|
||||
[21] => haval160,3
|
||||
[22] => haval192,3
|
||||
[23] => haval224,3
|
||||
[24] => haval256,3
|
||||
[25] => haval128,4
|
||||
[26] => haval160,4
|
||||
[27] => haval192,4
|
||||
[28] => haval224,4
|
||||
[29] => haval256,4
|
||||
[30] => haval128,5
|
||||
[31] => haval160,5
|
||||
[32] => haval192,5
|
||||
[33] => haval224,5
|
||||
[34] => haval256,5
|
||||
)
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
</refentry>
|
||||
|
||||
<!-- 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:"../../../../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
|
||||
-->
|
118
reference/hash/functions/hash-file.xml
Normal file
118
reference/hash/functions/hash-file.xml
Normal file
|
@ -0,0 +1,118 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1 $ -->
|
||||
<!-- Generated by xml_proto.php v2.3. Found in /scripts directory of phpdoc. -->
|
||||
<refentry id="function.hash-file">
|
||||
<refnamediv>
|
||||
<refname>hash_file</refname>
|
||||
<refpurpose>Generate a hash value using the contents of a given file</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>string</type><methodname>hash_file</methodname>
|
||||
<methodparam><type>string</type><parameter>algo</parameter></methodparam>
|
||||
<methodparam><type>string</type><parameter>filename</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>bool</type><parameter>raw_output</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
|
||||
</refsect1>
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>algo</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Name of selected hashing algorithm (i.e. "md5", "sha256", "haval160,4", etc..)
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>filename</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
URL describing location of file to be hashed; Supports fopen wrappers.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>raw_output</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
When set to &true;, outputs raw binary data.
|
||||
Default value (&false;) outpus lowercase hexits.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
Returns a string containing the calculated message digest as lowercase hexits
|
||||
unless <parameter>raw_output</parameter> is set to true in which case the raw
|
||||
binary representation of the message digest is returned.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title>Using <function>hash_file</function></title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
/* Create a file to calculate hash of */
|
||||
file_put_contents('example.txt', 'The quick brown fox jumped over the lazy dog.');
|
||||
|
||||
echo hash_file('md5', 'example.txt');
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
&example.outputs;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
5c6ffbdd40d9556b73a21e63c3e0e904
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><function>hash</function></member>
|
||||
<member><function>hash_hmac_file</function></member>
|
||||
<member>Or <function>hash_update_file</function></member>
|
||||
</simplelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
</refentry>
|
||||
|
||||
<!-- 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:"../../../../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
|
||||
-->
|
108
reference/hash/functions/hash-final.xml
Normal file
108
reference/hash/functions/hash-final.xml
Normal file
|
@ -0,0 +1,108 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1 $ -->
|
||||
<refentry id="function.hash-final">
|
||||
<refnamediv>
|
||||
<refname>hash_final</refname>
|
||||
<refpurpose>Finalize an incremental hash and return desulting digest</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>string</type><methodname>hash_final</methodname>
|
||||
<methodparam><type>resource</type><parameter>context</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>bool</type><parameter>raw_output</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
|
||||
</refsect1>
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>context</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Hashing context returned by <function>hash_init</function>.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>raw_output</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
When set to &true;, outputs raw binary data.
|
||||
Default value (&false;) outpus lowercase hexits.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
Returns a string containing the calculated message digest as lowercase hexits
|
||||
unless <parameter>raw_output</parameter> is set to true in which case the raw
|
||||
binary representation of the message digest is returned.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title><function>hash_final</function></title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$ctx = hash_init('sha1');
|
||||
hash_update($ctx, 'The quick brown fox jumped over the lazy dog.');
|
||||
echo hash_final($ctx);
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
&example.outputs;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
c0854fb9fb03c41cce3802cb0d220529e6eef94e
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><function>hash_init</function></member>
|
||||
<member><function>hash_update</function></member>
|
||||
<member><function>hash_update_stream</function></member>
|
||||
<member><function>hash_update_file</function></member>
|
||||
</simplelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
</refentry>
|
||||
|
||||
<!-- 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:"../../../../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
|
||||
-->
|
125
reference/hash/functions/hash-hmac-file.xml
Normal file
125
reference/hash/functions/hash-hmac-file.xml
Normal file
|
@ -0,0 +1,125 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1 $ -->
|
||||
<refentry id="function.hash-hmac-file">
|
||||
<refnamediv>
|
||||
<refname>hash_hmac_file</refname>
|
||||
<refpurpose>Generate a keyed hash value using the HMAC method and the contents of a given file</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>string</type><methodname>hash_hmac_file</methodname>
|
||||
<methodparam><type>string</type><parameter>algo</parameter></methodparam>
|
||||
<methodparam><type>string</type><parameter>filename</parameter></methodparam>
|
||||
<methodparam><type>string</type><parameter>key</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>bool</type><parameter>raw_output</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
|
||||
</refsect1>
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>algo</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Name of selected hashing algorithm (i.e. "md5", "sha256", "haval160,4", etc..)
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>filename</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
URL describing location of file to be hashed; Supports fopen wrappers.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>key</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Shared secret key used for generating the HMAC variant of the message digest.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>raw_output</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
When set to &true;, outputs raw binary data.
|
||||
Default value (&false;) outpus lowercase hexits.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
Returns a string containing the calculated message digest as lowercase hexits
|
||||
unless <parameter>raw_output</parameter> is set to true in which case the raw
|
||||
binary representation of the message digest is returned.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title><function>hash_hmac_file</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
/* Create a file to calculate hash of */
|
||||
file_put_contents('example.txt', 'The quick brown fox jumped over the lazy dog.');
|
||||
|
||||
echo hash_hmac_file('md5', 'example.txt', 'secret');
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
&example.outputs;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
7eb2b5c37443418fc77c136dd20e859c
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><function>hash_hmac</function></member>
|
||||
<member>Or <function>hash_file</function></member>
|
||||
</simplelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
</refentry>
|
||||
|
||||
<!-- 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:"../../../../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
|
||||
-->
|
123
reference/hash/functions/hash-hmac.xml
Normal file
123
reference/hash/functions/hash-hmac.xml
Normal file
|
@ -0,0 +1,123 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1 $ -->
|
||||
<refentry id="function.hash-hmac">
|
||||
<refnamediv>
|
||||
<refname>hash_hmac</refname>
|
||||
<refpurpose>Generate a keyed hash value using the HMAC method</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>string</type><methodname>hash_hmac</methodname>
|
||||
<methodparam><type>string</type><parameter>algo</parameter></methodparam>
|
||||
<methodparam><type>string</type><parameter>data</parameter></methodparam>
|
||||
<methodparam><type>string</type><parameter>key</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>bool</type><parameter>raw_output</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
|
||||
</refsect1>
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>algo</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Name of selected hashing algorithm (i.e. "md5", "sha256", "haval160,4", etc..)
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>data</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Message to be hashed.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>key</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Shared secret key used for generating the HMAC variant of the message digest.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>raw_output</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
When set to &true;, outputs raw binary data.
|
||||
Default value (&false;) outpus lowercase hexits.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
Returns a string containing the calculated message digest as lowercase hexits
|
||||
unless <parameter>raw_output</parameter> is set to true in which case the raw
|
||||
binary representation of the message digest is returned.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title><function>hash_hmac</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
echo hash_hmac('ripemd160', 'The quick brown fox jumped over the lazy dog.', 'secret');
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
&example.outputs;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
b8e7ae12510bdfb1812e463a7f086122cf37e4f7
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><function>hash</function></member>
|
||||
<member><function>hash_init</function></member>
|
||||
<member>Or <function>hash_hmac_file</function></member>
|
||||
</simplelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
</refentry>
|
||||
|
||||
<!-- 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:"../../../../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
|
||||
-->
|
122
reference/hash/functions/hash-init.xml
Normal file
122
reference/hash/functions/hash-init.xml
Normal file
|
@ -0,0 +1,122 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1 $ -->
|
||||
<!-- Generated by xml_proto.php v2.3. Found in /scripts directory of phpdoc. -->
|
||||
<refentry id="function.hash-init">
|
||||
<refnamediv>
|
||||
<refname>hash_init</refname>
|
||||
<refpurpose>Initialize an incremental hashing context</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>resource</type><methodname>hash_init</methodname>
|
||||
<methodparam><type>string</type><parameter>algo</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>int</type><parameter>options</parameter></methodparam>
|
||||
<methodparam><type>string</type><parameter>key</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
|
||||
</refsect1>
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>algo</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Name of selected hashing algorithm (i.e. "md5", "sha256", "haval160,4", etc..)
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>options</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Optional settings for hash generation, currently supports only one option:
|
||||
<constant>HASH_HMAC</constant>. When specified, the <parameter>key</parameter>
|
||||
<emphasis>must</emphasis> be specified.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>key</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
When <constant>HASH_HMAC</constant> is specified for <parameter>options</parameter>,
|
||||
a shared secret key to be used with the HMAC hashing method must be supplied in this
|
||||
parameter.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
Returns a Hashing Context resource for use with <function>hash_update</function>,
|
||||
<function>hash_update_stream</function>, <function>hash_update_file</function>,
|
||||
and <function>hash_final</function>.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title>Incremental hashing example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$ctx = hash_init('md5');
|
||||
hash_update($ctx, 'The quick brown fox ');
|
||||
hash_update($ctx, 'jumped over the lazy dog.');
|
||||
echo hash_final($ctx);
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
&example.outputs;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
5c6ffbdd40d9556b73a21e63c3e0e904
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><function>hash</function></member>
|
||||
<member><function>hash_file</function></member>
|
||||
<member><function>hash_hmac</function></member>
|
||||
<member>Or <function>hash_hmac_file</function></member>
|
||||
</simplelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
</refentry>
|
||||
|
||||
<!-- 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:"../../../../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
|
||||
-->
|
92
reference/hash/functions/hash-update-file.xml
Normal file
92
reference/hash/functions/hash-update-file.xml
Normal file
|
@ -0,0 +1,92 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1 $ -->
|
||||
<refentry id="function.hash-update-file">
|
||||
<refnamediv>
|
||||
<refname>hash_update_file</refname>
|
||||
<refpurpose>Pump data into an active hashing context from a file</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>hash_update_file</methodname>
|
||||
<methodparam><type>resource</type><parameter>context</parameter></methodparam>
|
||||
<methodparam><type>string</type><parameter>filename</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>resource</type><parameter>context</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
|
||||
</refsect1>
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>context</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Hashing context returned by <function>hash_init</function>.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>filename</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
URL describing location of file to be hashed; Supports fopen wrappers.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>context</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Stream context as returned by <function>stream_context_create</function>.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
&return.success;
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><function>hash_init</function></member>
|
||||
<member><function>hash_update</function></member>
|
||||
<member><function>hash_update_stream</function></member>
|
||||
<member><function>hash_final</function></member>
|
||||
<member><function>hash</function></member>
|
||||
<member>Or <function>hash_file</function></member>
|
||||
</simplelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
</refentry>
|
||||
|
||||
<!-- 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:"../../../../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
|
||||
-->
|
120
reference/hash/functions/hash-update-stream.xml
Normal file
120
reference/hash/functions/hash-update-stream.xml
Normal file
|
@ -0,0 +1,120 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1 $ -->
|
||||
<refentry id="function.hash-update-stream">
|
||||
<refnamediv>
|
||||
<refname>hash_update_stream</refname>
|
||||
<refpurpose>Pump data into an active hashing context from an open stream</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>int</type><methodname>hash_update_stream</methodname>
|
||||
<methodparam><type>resource</type><parameter>context</parameter></methodparam>
|
||||
<methodparam><type>resource</type><parameter>handle</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>integer</type><parameter>length</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
|
||||
</refsect1>
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>context</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Hashing context returned by <function>hash_init</function>.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>handle</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Open file handle as returned by any stream creation function.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>length</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Maximum number of characters to copy from <parameter>handle</parameter>
|
||||
into the hashing context.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
Actual number of bytes added to the hashing context from <parameter>handle</parameter>.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title><function>hash_update_stream</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$fp = tmpfile();
|
||||
fwrite($fp, 'The quick brown fox jumped over the lazy dog.');
|
||||
rewind($fp);
|
||||
|
||||
$ctx = hash_init('md5');
|
||||
hash_update_stream($ctx, $fp);
|
||||
echo hash_final($ctx);
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
&example.outputs;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
5c6ffbdd40d9556b73a21e63c3e0e904
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><function>hash_init</function></member>
|
||||
<member><function>hash_update</function></member>
|
||||
<member><function>hash_final</function></member>
|
||||
<member><function>hash</function></member>
|
||||
<member><function>hash_file</function></member>
|
||||
</simplelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
</refentry>
|
||||
|
||||
<!-- 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:"../../../../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
|
||||
-->
|
81
reference/hash/functions/hash-update.xml
Normal file
81
reference/hash/functions/hash-update.xml
Normal file
|
@ -0,0 +1,81 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1 $ -->
|
||||
<refentry id="function.hash-update">
|
||||
<refnamediv>
|
||||
<refname>hash_update</refname>
|
||||
<refpurpose>Pump data into an active hashing context</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>hash_update</methodname>
|
||||
<methodparam><type>resource</type><parameter>context</parameter></methodparam>
|
||||
<methodparam><type>string</type><parameter>data</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
|
||||
</refsect1>
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>context</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Hashing context returned by <function>hash_init</function>.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>data</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Message to be included in the hash digest.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
Returns &true;
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><function>hash_init</function></member>
|
||||
<member><function>hash_update_file</function></member>
|
||||
<member><function>hash_update_stream</function></member>
|
||||
<member>Or <function>hash_final</function></member>
|
||||
</simplelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
</refentry>
|
||||
|
||||
<!-- 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:"../../../../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
|
||||
-->
|
114
reference/hash/functions/hash.xml
Normal file
114
reference/hash/functions/hash.xml
Normal file
|
@ -0,0 +1,114 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1 $ -->
|
||||
<refentry id="function.hash">
|
||||
<refnamediv>
|
||||
<refname>hash</refname>
|
||||
<refpurpose>Generate a keyed hash value using the HMAC method</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>string</type><methodname>hash</methodname>
|
||||
<methodparam><type>string</type><parameter>algo</parameter></methodparam>
|
||||
<methodparam><type>string</type><parameter>data</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>bool</type><parameter>raw_output</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
|
||||
</refsect1>
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>algo</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Name of selected hashing algorithm (i.e. "md5", "sha256", "haval160,4", etc..)
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>data</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Message to be hashed.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>raw_output</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
When set to &true;, outputs raw binary data.
|
||||
Default value (&false;) outpus lowercase hexits.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
Returns a string containing the calculated message digest as lowercase hexits
|
||||
unless <parameter>raw_output</parameter> is set to true in which case the raw
|
||||
binary representation of the message digest is returned.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title>A <function>hash</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
echo hash('ripemd160', 'The quick brown fox jumped over the lazy dog.');
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
&example.outputs;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
ec457d0a974c48d5685a7efa03d137dc8bbde7e3
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><function>hash_file</function></member>
|
||||
<member><function>hash_hmac</function></member>
|
||||
<member>Or <function>hash_init</function></member>
|
||||
</simplelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
</refentry>
|
||||
|
||||
<!-- 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:"../../../../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
|
||||
-->
|
51
reference/hash/reference.xml
Normal file
51
reference/hash/reference.xml
Normal file
|
@ -0,0 +1,51 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1 $ -->
|
||||
<reference id="ref.hash">
|
||||
<title>hash Functions</title>
|
||||
<titleabbrev>hash</titleabbrev>
|
||||
|
||||
<partintro>
|
||||
<section id="hash.intro">
|
||||
&reftitle.intro;
|
||||
<para>
|
||||
Message Digest (hash) engine. Allows direct or incremental processing
|
||||
of arbitrary length messages using a variety of hashing algorithms.
|
||||
</para>
|
||||
</section>
|
||||
<section id="hash.requirements">
|
||||
&reftitle.required;
|
||||
<simpara>
|
||||
The Hash extension requires no external libraries and is enabled by
|
||||
default as of PHP 5.1.2. It may be explicitly disabled by using the
|
||||
--disable-hash switch to configure. Earlier versions of PHP may
|
||||
incorporate the Hash extension by installing the
|
||||
<ulink url="&url.pecl.package;hash">PECL module</ulink>.
|
||||
</simpara>
|
||||
</section>
|
||||
|
||||
<!-- Information found in constants.xml -->
|
||||
&reference.hash.constants;
|
||||
</partintro>
|
||||
&reference.hash.functions;
|
||||
</reference>
|
||||
|
||||
<!-- 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:"../../../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
|
||||
-->
|
Loading…
Reference in a new issue