Files
doc-fr/reference/hash/functions/hash-file.xml
2021-12-29 15:47:21 +00:00

157 lines
4.5 KiB
XML
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. 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"?>
<!-- EN-Revision: ac6b36357e5f5294a2c0577b85d193d84f0017ff Maintainer: yannick Status: ready -->
<!-- Reviewed: yes -->
<refentry xml:id="function.hash-file" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>hash_file</refname>
<refpurpose>Génère une valeur de hachage en utilisant le contenu d'un fichier donné</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type class="union"><type>string</type><type>false</type></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>binary</parameter><initializer>&false;</initializer></methodparam>
<methodparam choice="opt"><type>array</type><parameter>options</parameter><initializer>[]</initializer></methodparam>
</methodsynopsis>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>algo</parameter></term>
<listitem>
<para>
Nom de l'algorithme de hachage sélectionné (c'est-à-dire "md5",
"sha256", "haval160,4", etc.). Pour une liste des algorithmes
disponibles voir <function>hash_algos</function>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>filename</parameter></term>
<listitem>
<para>
URL indiquant l'emplacement du fichier qui sera haché;
Supporte les enveloppes <function>fopen</function>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>binary</parameter></term>
<listitem>
<para>
Lorsqu'il vaut &true;, la sortie sera des données brutes binaires.
Lorsqu'il vaut &false;, la sortie sera des chiffres hexadécimaux en
minuscule.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>options</parameter></term>
<listitem>
<para>
Un tableau d'options pour les algorithmes dives de hachage.
Actuellement, seul le paramètre "seed" est supporté pour les variantes MurmurHash.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Retourne une chaîne de caractères contenant l'empreinte numérique calculée
en chiffre hexadécimal minuscule à moins que
<parameter>binary</parameter> soit fixé à &true;. Dans ce cas, la
représentation brute binaire de l'empreinte numérique est retournée.
</para>
</refsect1>
<refsect1 role="changelog">
&reftitle.changelog;
<para>
<informaltable>
<tgroup cols="2">
<thead>
<row>
<entry>&Version;</entry>
<entry>&Description;</entry>
</row>
</thead>
<tbody>
<row>
<entry>8.1.0</entry>
<entry>Le paramètre <parameter>options</parameter> a été ajouté.</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Exemple avec <function>hash_file</function></title>
<programlisting role="php">
<![CDATA[
<?php
/* Crée un fichier pour calculer son empreinte numérique */
file_put_contents('exemple.txt', 'Le rapide goupil brun sauta par dessus le chien paresseux.');
echo hash_file('md5', 'exemple.txt');
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
2dfe052a8caca3db869ede6ae544cd5d
]]>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>hash</function></member>
<member><function>hash_hmac_file</function></member>
<member><function>hash_update_file</function></member>
<member><function>md5_file</function></member>
<member><function>sha1_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:"~/.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
-->