reference/hash/functions/hash-hmac-file.xml
50960545e781ff94ba371befc04346de48a0bb82
...
...
@@ -8,11 +8,11 @@
8
8
<refsect1 role="description">
9
9
&reftitle.description;
10
10
<methodsynopsis>
11
-
<type>string</type><methodname>hash_hmac_file</methodname>
11
+
<type class="union"><type>string</type><type>false</type></type><methodname>hash_hmac_file</methodname>
12
12
<methodparam><type>string</type><parameter>algo</parameter></methodparam>
13
13
<methodparam><type>string</type><parameter>filename</parameter></methodparam>
14
14
<methodparam><type>string</type><parameter>key</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
16
</methodsynopsis>
17
17

18
18
</refsect1>
...
...
@@ -24,7 +24,7 @@
24
24
<term><parameter>algo</parameter></term>
25
25
<listitem>
26
26
<para>
27
-
Name of selected hashing algorithm (i.e. "md5", "sha256", "haval160,4", etc..) See <function>hash_algos</function> for a list of supported algorithms.
27
+
Name of selected hashing algorithm (i.e. "md5", "sha256", "haval160,4", etc..) See <function>hash_hmac_algos</function> for a list of supported algorithms.
28
28
</para>
29
29
</listitem>
30
30
</varlistentry>
...
...
@@ -45,7 +45,7 @@
45
45
</listitem>
46
46
</varlistentry>
47
47
<varlistentry>
48
-
<term><parameter>raw_output</parameter></term>
48
+
<term><parameter>binary</parameter></term>
49
49
<listitem>
50
50
<para>
51
51
When set to &true;, outputs raw binary data.
...
...
@@ -61,8 +61,47 @@
61
61
&reftitle.returnvalues;
62
62
<para>
63
63
Returns a string containing the calculated message digest as lowercase hexits
64
-
unless <parameter>raw_output</parameter> is set to true in which case the raw
64
+
unless <parameter>binary</parameter> is set to true in which case the raw
65
65
binary representation of the message digest is returned.
66
+
Returns &false; if the file <parameter>filename</parameter> cannot be read.
67
+
</para>
68
+
</refsect1>
69
+

70
+
<refsect1 role="errors">
71
+
&reftitle.errors;
72
+
<para>
73
+
Throws a <classname>ValueError</classname> exception if
74
+
<parameter>algo</parameter> is unknown or is a non-cryptographic hash function.
75
+
</para>
76
+
</refsect1>
77
+

78
+
<refsect1 role="changelog">
79
+
&reftitle.changelog;
80
+
<para>
81
+
<informaltable>
82
+
<tgroup cols="2">
83
+
<thead>
84
+
<row>
85
+
<entry>&Version;</entry>
86
+
<entry>&Description;</entry>
87
+
</row>
88
+
</thead>
89
+
<tbody>
90
+
<row>
91
+
<entry>8.0.0</entry>
92
+
<entry>
93
+
Now throws a <classname>ValueError</classname> exception if
94
+
<parameter>algo</parameter> is unknown or is a non-cryptographic hash
95
+
function; previously, &false; was returned instead.
96
+
</entry>
97
+
</row>
98
+
<row>
99
+
<entry>7.2.0</entry>
100
+
<entry>Usage of non-cryptographic hash functions (adler32, crc32, crc32b, fnv132, fnv1a32, fnv164, fnv1a64, joaat) was disabled.</entry>
101
+
</row>
102
+
</tbody>
103
+
</tgroup>
104
+
</informaltable>
66
105
</para>
67
106
</refsect1>
68
107

...
...
@@ -77,14 +116,14 @@
77
116
/* Create a file to calculate hash of */
78
117
file_put_contents('example.txt', 'The quick brown fox jumped over the lazy dog.');
79
118

80
-
echo hash_hmac_file('md5', 'example.txt', 'secret');
119
+
echo hash_hmac_file('sha256', 'example.txt', 'secret');
81
120
?>
82
121
]]>
83
122
</programlisting>
84
123
&example.outputs;
85
124
<screen>
86
125
<![CDATA[
87
-
7eb2b5c37443418fc77c136dd20e859c
126
+
9c5c42422b03f0ee32949920649445e417b2c634050833c5165704b825c2a53b
88
127
]]>
89
128
</screen>
90
129
</example>
...
...
@@ -95,7 +134,7 @@ echo hash_hmac_file('md5', 'example.txt', 'secret');
95
134
&reftitle.seealso;
96
135
<para>
97
136
<simplelist>
98
-
<member><function>hash_algos</function></member>
137
+
<member><function>hash_hmac_algos</function></member>
99
138
<member><function>hash_hmac</function></member>
100
139
<member><function>hash_file</function></member>
101
140
</simplelist>
...
...
@@ -103,7 +142,6 @@ echo hash_hmac_file('md5', 'example.txt', 'secret');
103
142
</refsect1>
104
143

105
144
</refentry>
106
-

107
145
<!-- Keep this comment at the end of the file
108
146
Local variables:
109
147
mode: sgml
110
148