php-doc-en/reference/mcrypt/functions/mcrypt-generic-init.xml
Derick Rethans baf0dab17e - Overhaul of the mcrypt docs, including new examples, corrected entries and
newly documented functions


git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@82020 c90b9560-bf6c-de11-be94-00142212c4b1
2002-05-12 21:00:20 +00:00

60 lines
2.2 KiB
XML

<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.3 $ -->
<!-- splitted from ./en/functions/mcrypt.xml, last change in rev 1.7 -->
<refentry id="function.mcrypt-generic-init">
<refnamediv>
<refname>mcrypt_generic_init</refname>
<refpurpose>This function initializes all buffers needed for encryption</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>mcrypt_generic_init</methodname>
<methodparam><type>resource</type><parameter>td</parameter></methodparam>
<methodparam><type>string</type><parameter>key</parameter></methodparam>
<methodparam><type>string</type><parameter>iv</parameter></methodparam>
</methodsynopsis>
<para>
The maximum length of the key should be the one obtained by
calling <function>mcrypt_enc_get_key_size</function> and every
value smaller than this is legal. The IV should normally have
the size of the algorithms block size, but you must obtain the
size by calling <function>mcrypt_enc_get_iv_size</function>.
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. The function returns a negative value on error.
</para>
<para>
You need to call this function before every call to
<function>mcrypt_generic</function> or
<function>mdecrypt_generic</function>.
</para>
<para>
See for an example <function>mcrypt_module_open</function> and the
entry on <function>mcrypt_generic_deinit</function>.
</para>
</refsect1>
</refentry>
<!-- 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:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->