<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.mcrypt.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'uk',
  ),
  'this' => 
  array (
    0 => 'function.mcrypt-generic-init.php',
    1 => 'mcrypt_generic_init',
    2 => 'This function initializes all buffers needed for encryption',
  ),
  'up' => 
  array (
    0 => 'ref.mcrypt.php',
    1 => 'Функції Mcrypt',
  ),
  'prev' => 
  array (
    0 => 'function.mcrypt-generic-deinit.php',
    1 => 'mcrypt_generic_deinit',
  ),
  'next' => 
  array (
    0 => 'function.mcrypt-get-block-size.php',
    1 => 'mcrypt_get_block_size',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/mcrypt/functions/mcrypt-generic-init.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.mcrypt-generic-init" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">mcrypt_generic_init</h1>
  <p class="verinfo">(PHP 4 &gt;= 4.0.2, PHP 5, PHP 7 &lt; 7.2.0, PECL mcrypt &gt;= 1.0.0)</p><p class="refpurpose"><span class="refname">mcrypt_generic_init</span> &mdash; <span class="dc-title">This function initializes all buffers needed for encryption</span></p>

 </div>
 <div id="function.mcrypt-generic-init-refsynopsisdiv">
  <div class="warning"><strong class="warning">Увага</strong><p class="simpara">Ця функція
<em>ЗАСТАРІЛА</em>, починаючи з PHP 7.1.0, та
<em>ВИЛУЧЕНА</em> в PHP 7.2.0. Вкрай не рекомендується на неї
покладатися.</p></div>
 </div>
 <div class="refsect1 description" id="refsect1-function.mcrypt-generic-init-description">
  <h3 class="title">Опис</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>mcrypt_generic_init</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.resource.php" class="type resource">resource</a></span> <code class="parameter">$td</code></span>, <span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$key</code></span>, <span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$iv</code></span>): <span class="type"><a href="language.types.integer.php" class="type int">int</a></span></div>

  <p class="para rdfs-comment">
   You need to call this function before every call to
   <span class="function"><a href="function.mcrypt-generic.php" class="function">mcrypt_generic()</a></span> or
   <span class="function"><a href="function.mdecrypt-generic.php" class="function">mdecrypt_generic()</a></span>.
  </p>
 </div>

 <div class="refsect1 parameters" id="refsect1-function.mcrypt-generic-init-parameters">
  <h3 class="title">Параметри</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">td</code></dt>
     <dd>
      <p class="para">
       The encryption descriptor.
      </p>
     </dd>
    
    
     <dt><code class="parameter">key</code></dt>
     <dd>
      <p class="para">
       The maximum length of the key should be the one obtained by calling
       <span class="function"><a href="function.mcrypt-enc-get-key-size.php" class="function">mcrypt_enc_get_key_size()</a></span> and every value smaller
       than this is legal.
      </p>
     </dd>
    
    
     <dt><code class="parameter">iv</code></dt>
     <dd>
      <p class="para">
       The IV should normally have the size of the algorithms block size, but
       you must obtain the size by calling
       <span class="function"><a href="function.mcrypt-enc-get-iv-size.php" class="function">mcrypt_enc_get_iv_size()</a></span>. IV is ignored in ECB. IV
       MUST exist in CFB, CBC, STREAM, nOFB and OFB modes. It needs to be
       random and unique (but not secret). The same IV must be used for
       encryption/decryption. If you do not want to use it you should set it
       to zeros, but this is not recommended.
      </p>
     </dd>
    
   </dl>
  </p>
 </div>

 <div class="refsect1 returnvalues" id="refsect1-function.mcrypt-generic-init-returnvalues">
  <h3 class="title">Значення, що повертаються</h3>
  <p class="para">
   The function returns a negative value on error: -3 when the key length
   was incorrect, -4 when there was a memory allocation problem and any
   other return value is an unknown error. If an error occurs a warning will
   be displayed accordingly. <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> is returned if incorrect parameters
   were passed.
  </p>
 </div>

 <div class="refsect1 seealso" id="refsect1-function.mcrypt-generic-init-seealso">
  <h3 class="title">Прогляньте також</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="function"><a href="function.mcrypt-module-open.php" class="function" rel="rdfs-seeAlso">mcrypt_module_open()</a> - Opens the module of the algorithm and the mode to be used</span></li>
   </ul>
  </p>
 </div>

</div><?php manual_footer($setup); ?>