<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/book.mhash.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'ru',
  ),
  'this' => 
  array (
    0 => 'mhash.examples.php',
    1 => 'Примеры',
    2 => 'Примеры',
  ),
  'up' => 
  array (
    0 => 'book.mhash.php',
    1 => 'Mhash',
  ),
  'prev' => 
  array (
    0 => 'mhash.constants.php',
    1 => 'Предопределённые константы',
  ),
  'next' => 
  array (
    0 => 'ref.mhash.php',
    1 => 'Функции Mhash',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'ru',
    'path' => 'reference/mhash/examples.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="mhash.examples" class="appendix">
 <h1 class="title">Примеры</h1>

 <p class="para">
  <div class="example" id="example-1">
   <p><strong>Пример #1 Вычисление MD5 и HMAC и печать их в шестнадцатеричном виде</strong></p>
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />$input </span><span style="color: #007700">= </span><span style="color: #DD0000">"what do ya want for nothing?"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$hash </span><span style="color: #007700">= </span><span style="color: #0000BB">mhash</span><span style="color: #007700">(</span><span style="color: #0000BB">MHASH_MD5</span><span style="color: #007700">, </span><span style="color: #0000BB">$input</span><span style="color: #007700">);<br />echo </span><span style="color: #DD0000">"Хеш MD5 - " </span><span style="color: #007700">. </span><span style="color: #0000BB">bin2hex</span><span style="color: #007700">(</span><span style="color: #0000BB">$hash</span><span style="color: #007700">) . </span><span style="color: #DD0000">"&lt;br /&gt;\n"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$hash </span><span style="color: #007700">= </span><span style="color: #0000BB">mhash</span><span style="color: #007700">(</span><span style="color: #0000BB">MHASH_MD5</span><span style="color: #007700">, </span><span style="color: #0000BB">$input</span><span style="color: #007700">, </span><span style="color: #DD0000">"Jefe"</span><span style="color: #007700">);<br />echo </span><span style="color: #DD0000">"Хеш HMAC - " </span><span style="color: #007700">. </span><span style="color: #0000BB">bin2hex</span><span style="color: #007700">(</span><span style="color: #0000BB">$hash</span><span style="color: #007700">) . </span><span style="color: #DD0000">"&lt;br /&gt;\n"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
   </div>

   
<div class="example-contents"><p>
 Результат выполнения приведённого примера:
</p></div>

   <div class="example-contents screen">
<div class="cdata"><pre>
Хеш MD5 - d03cb659cbf9192dcd066272249f8412
Хеш HMAC - 750c783e6ab0b503eaa86e310a5db738
</pre></div>
   </div>
  </div>
 </p>
</div>
<?php manual_footer($setup); ?>