1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282
|
<?xml version="1.0" encoding="iso-8859-2"?>
<reference id="ref.mhash">
<title>Mhash funkce</title>
<titleabbrev>mhash</titleabbrev>
<partintro>
<para>
Tyto funkce jsou ureny pro prci s <ulink url="&url.mhash;">mhash</ulink>.
</para>
<para>
Toto je interface ke knihvn mhash. mhash podporuje irokou klu hash
algoritm jako nap. MD5, SHA1, GOST a mnoho jinch.
</para>
<para>
Pokud chcete tyto funkce pouvat, sthnte si mhash distribuci z <ulink
url="&url.mhash;">its web site</ulink> a postupujte podle piloench
instrukc k instalaci. K aktivaci tohoto modulu budete muset zkompilovat PHP
s volbou <option role="configure">--with-mhash</option>
</para>
<para>
Mhash se d pout k vytven kontrolnch sout, message digests, message
authentication codes, and more.
</para>
<para>
<example>
<title>Compute the MD5 digest and hmac and print it out as hex</title>
<programlisting role="php">
<?php
$input = "what do ya want for nothing?";
$hash = mhash (MHASH_MD5, $input);
print "The hash is ".bin2hex ($hash)."\n<br>";
$hash = mhash (MHASH_MD5, $input, "Jefe");
print "The hmac is ".bin2hex ($hash)."\n<br>";
?>
</programlisting>
</example>
This will produce:
<programlisting>
The hash is d03cb659cbf9192dcd066272249f8412
The hmac is 750c783e6ab0b503eaa86e310a5db738
</programlisting>
Kompletn seznam podporovanch hash viz dokumentaci mhash. Obecnm pravidlem
je, e hash algoritmus je dostupn z PHP pomoc MHASH_NAZEVHASHE. Napklad
TIGER se v PHP pouv pomoc konstanty MHASH_TIGER.
</para>
<para>
Zde je seznam hash podporovanch mhashem v souasn dob. Pokud zde nen
nkter hash jmenovn, ale v dokumentaci mhashe je uveden jako podporovan,
mete bezpen pedpokldat, e je tato dokumentace zastaral.
<itemizedlist>
<listitem>
<simpara>
MHASH_MD5
</simpara>
</listitem>
<listitem>
<simpara>
MHASH_SHA1
</simpara>
</listitem>
<listitem>
<simpara>
MHASH_HAVAL256
</simpara>
</listitem>
<listitem>
<simpara>
MHASH_HAVAL192
</simpara>
</listitem>
<listitem>
<simpara>
MHASH_HAVAL160
</simpara>
</listitem>
<listitem>
<simpara>
MHASH_HAVAL128
</simpara>
</listitem>
<listitem>
<simpara>
MHASH_RIPEMD160
</simpara>
</listitem>
<listitem>
<simpara>
MHASH_GOST
</simpara>
</listitem>
<listitem>
<simpara>
MHASH_TIGER
</simpara>
</listitem>
<listitem>
<simpara>
MHASH_CRC32
</simpara>
</listitem>
<listitem>
<simpara>
MHASH_CRC32B
</simpara>
</listitem>
</itemizedlist>
</para>
</partintro>
<refentry id="function.mhash-get-hash-name">
<refnamediv>
<refname>mhash_get_hash_name</refname>
<refpurpose>Zskat nzev zadanho hashe</refpurpose>
</refnamediv>
<refsect1>
<title>Popis</title>
<methodsynopsis>
<type>string</type><methodname>mhash_get_hash_name</methodname>
<methodparam><type>int</type><parameter>hash</parameter></methodparam>
</methodsynopsis>
<para>
<function>mhash_get_hash_name</function> se pouv ke zjitn nzvu
zadanho hashe.
</para>
<para>
<function>mhash_get_hash_name</function> pijm id hashe jako argument a
vrac nzev tohoto hashe nebo &false;, pokud tento hash
neexistuje.
</para>
<para>
<example>
<title>Ukzka <function>mhash_get_hash_name</function></title>
<programlisting>
<?php
$hash = MHASH_MD5;
print mhash_get_hash_name ($hash);
?>
</programlisting>
</example>
Ve uveden ukzka vytiskne:
<programlisting>
MD5
</programlisting>
</para>
</refsect1>
</refentry>
<refentry id="function.mhash-get-block-size">
<refnamediv>
<refname>mhash_get_block_size</refname>
<refpurpose>Zskat velikost bloku urenho hashe</refpurpose>
</refnamediv>
<refsect1>
<title>Popis</title>
<methodsynopsis>
<type>int</type><methodname>mhash_get_block_size</methodname>
<methodparam><type>int</type><parameter>hash</parameter></methodparam>
</methodsynopsis>
<para>
<function>mhash_get_block_size</function> se pouv ke zjitn velikosti
bloku argumentu <parameter>hash</parameter>.
</para>
<para>
<function>mhash_get_block_size</function> pijm jeden argument,
<parameter>hash</parameter> a vrac velikost v bytech nebo
&false;, pokud <parameter>hash</parameter> neexistuje.
</para>
</refsect1>
</refentry>
<refentry id="function.mhash-count">
<refnamediv>
<refname>mhash_count</refname>
<refpurpose>Zskat nejvy dostupn hash id</refpurpose>
</refnamediv>
<refsect1>
<title>Popis</title>
<methodsynopsis>
<type>int</type><methodname>mhash_count</methodname>
<void/>
</methodsynopsis>
<para>
<function>mhash_count</function> vrac nejvy dostupn hash id. Hashe jsou
slovan od 0 po toto hash id.
</para>
<para>
<example>
<title>Traversing all hashes</title>
<programlisting role="php">
<?php
$nr = mhash_count();
for ($i = 0; $i <= $nr; $i++) {
echo sprintf ("The blocksize of %s is %d\n",
mhash_get_hash_name ($i),
mhash_get_block_size ($i));
}
?>
</programlisting>
</example>
</para>
</refsect1>
</refentry>
<refentry id="function.mhash">
<refnamediv>
<refname>mhash</refname>
<refpurpose>Spotat hash</refpurpose>
</refnamediv>
<refsect1>
<title>Popis</title>
<methodsynopsis>
<type>string</type><methodname>mhash</methodname>
<methodparam><type>int</type><parameter>hash</parameter></methodparam>
<methodparam><type>string</type><parameter>data</parameter></methodparam>
<methodparam><type>string</type><parameter>[ key ]</parameter></methodparam>
</methodsynopsis>
<para>
<function>mhash</function> aplikuje hash funkci urenou argumentem
<parameter>hash</parameter> na <parameter>data</parameter> a vrac vsledn
hash (tak nazvan digest). Pokud je pedn <parameter> key</parameter>,
vrac vsledn HMAC. HMAC is keyed hashing for message authentication,
or simply a message digest that depends on the specified key. Not all
algorithms supported in mhash can be used in HMAC mode. In case of an error
returns &false;.
</para>
</refsect1>
</refentry>
<refentry id="function.mhash-keygen-s2k">
<refnamediv>
<refname>mhash_keygen_s2k</refname>
<refpurpose>Vygenerovat kl</refpurpose>
</refnamediv>
<refsect1>
<title>Popis</title>
<methodsynopsis>
<type>string</type><methodname>mhash_keygen_s2k</methodname>
<methodparam><type>int</type><parameter>hash</parameter></methodparam>
<methodparam><type>string</type><parameter>password</parameter></methodparam>
<methodparam><type>string</type><parameter>salt</parameter></methodparam>
<methodparam><type>int</type><parameter>bytes</parameter></methodparam>
</methodsynopsis>
<para>
<function>mhash_keygen_s2k</function> generuje kl, kter je
<parameter>bytes</parameter> dlouh, z pedanho hesla. Toto je Salted S2K
algoritmus specifikovan v OpenPGP dokumentu (RFC 2440). Tento algoritmus
pouije k vytvoen kle <parameter>hash</parameter> algoritmus.
<parameter>salt</parameter> mus bt pro kad generovan kl jin a
dostaten nhodn, aby vytvoil rzn kle.
Salt mus bt pi kontrole kl znm, tud je dobr npad ho pipojit
ke kli. Salt ma pevnou dlku 8 byt a pokud dodte mn byt, bude
doplnn nulami.
Pamatujte, e uivatelsky uren hesla nejsou vhodn k pouit jako kle,
protoe uivatel obvykle vol kle, kter mohou napsat na klvesnici.
Tato hesla vyuvaj pouze 6 a 7 byt na znak (nebo mn). Je velmi vhodn
na uivateli uren kle pout njakou transformaci (jako je tato funkce).
</para>
</refsect1>
</refentry>
</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:
-->
|