reference/hash/functions/hash-file.xml
05b26e8d7aa7f3c6830efe4961b2c0e4b28fe450
...
...
@@ -9,10 +9,11 @@
9
9
<refsect1 role="description">
10
10
&reftitle.description;
11
11
<methodsynopsis>
12
-
<type>string</type><methodname>hash_file</methodname>
12
+
<type class="union"><type>string</type><type>false</type></type><methodname>hash_file</methodname>
13
13
<methodparam><type>string</type><parameter>algo</parameter></methodparam>
14
14
<methodparam><type>string</type><parameter>filename</parameter></methodparam>
15
-
<methodparam choice="opt"><type>bool</type><parameter>raw_output</parameter><initializer>&false;</initializer></methodparam>
15
+
<methodparam choice="opt"><type>bool</type><parameter>binary</parameter><initializer>&false;</initializer></methodparam>
16
+
<methodparam choice="opt"><type>array</type><parameter>options</parameter><initializer>[]</initializer></methodparam>
16
17
</methodsynopsis>
17
18

18
19
</refsect1>
...
...
@@ -24,7 +25,8 @@
24
25
<term><parameter>algo</parameter></term>
25
26
<listitem>
26
27
<para>
27
-
Name of selected hashing algorithm (i.e. "md5", "sha256", "haval160,4", etc..). For a list of supported algorithms see <function>hash_algos</function>.
28
+
Name of selected hashing algorithm (e.g. <literal>"sha256"</literal>).
29
+
For a list of supported algorithms see <function>hash_algos</function>.
28
30
</para>
29
31
</listitem>
30
32
</varlistentry>
...
...
@@ -32,12 +34,12 @@
32
34
<term><parameter>filename</parameter></term>
33
35
<listitem>
34
36
<para>
35
-
URL describing location of file to be hashed; Supports fopen wrappers.
37
+
URL describing location of file to be hashed; Supports <function>fopen</function> wrappers.
36
38
</para>
37
39
</listitem>
38
40
</varlistentry>
39
41
<varlistentry>
40
-
<term><parameter>raw_output</parameter></term>
42
+
<term><parameter>binary</parameter></term>
41
43
<listitem>
42
44
<para>
43
45
When set to &true;, outputs raw binary data.
...
...
@@ -45,6 +47,16 @@
45
47
</para>
46
48
</listitem>
47
49
</varlistentry>
50
+
<varlistentry>
51
+
<term><parameter>options</parameter></term>
52
+
<listitem>
53
+
<para>
54
+
An array of options for the various hashing algorithms.
55
+
Currently, only the <literal>"seed"</literal> parameter is
56
+
supported by the MurmurHash variants.
57
+
</para>
58
+
</listitem>
59
+
</varlistentry>
48
60
</variablelist>
49
61
</para>
50
62
</refsect1>
...
...
@@ -53,8 +65,30 @@
53
65
&reftitle.returnvalues;
54
66
<para>
55
67
Returns a string containing the calculated message digest as lowercase hexits
56
-
unless <parameter>raw_output</parameter> is set to true in which case the raw
57
-
binary representation of the message digest is returned.
68
+
unless <parameter>binary</parameter> is set to true in which case the raw
69
+
binary representation of the message digest is returned, &return.falseforfailure;.
70
+
</para>
71
+
</refsect1>
72
+

73
+
<refsect1 role="changelog">
74
+
&reftitle.changelog;
75
+
<para>
76
+
<informaltable>
77
+
<tgroup cols="2">
78
+
<thead>
79
+
<row>
80
+
<entry>&Version;</entry>
81
+
<entry>&Description;</entry>
82
+
</row>
83
+
</thead>
84
+
<tbody>
85
+
<row>
86
+
<entry>8.1.0</entry>
87
+
<entry>The <parameter>options</parameter> parameter has been added.</entry>
88
+
</row>
89
+
</tbody>
90
+
</tgroup>
91
+
</informaltable>
58
92
</para>
59
93
</refsect1>
60
94

...
...
@@ -69,14 +103,14 @@
69
103
/* Create a file to calculate hash of */
70
104
file_put_contents('example.txt', 'The quick brown fox jumped over the lazy dog.');
71
105

72
-
echo hash_file('md5', 'example.txt');
106
+
echo hash_file('sha256', 'example.txt');
73
107
?>
74
108
]]>
75
109
</programlisting>
76
110
&example.outputs;
77
111
<screen>
78
112
<![CDATA[
79
-
5c6ffbdd40d9556b73a21e63c3e0e904
113
+
68b1282b91de2c054c36629cb8dd447f12f096d3e3c587978dc2248444633483
80
114
]]>
81
115
</screen>
82
116
</example>
...
...
@@ -87,17 +121,13 @@ echo hash_file('md5', 'example.txt');
87
121
&reftitle.seealso;
88
122
<para>
89
123
<simplelist>
90
-
<member><function>hash</function></member>
124
+
<member><function>hash_init</function></member>
91
125
<member><function>hash_hmac_file</function></member>
92
-
<member><function>hash_update_file</function></member>
93
-
<member><function>md5_file</function></member>
94
-
<member><function>sha1_file</function></member>
95
126
</simplelist>
96
127
</para>
97
128
</refsect1>
98
129

99
130
</refentry>
100
-

101
131
<!-- Keep this comment at the end of the file
102
132
Local variables:
103
133
mode: sgml
104
134