php-doc-en/reference/mcrypt/functions/mcrypt-generic-init.xml
Jakub Vrana 74ae6ee964 Can return false (bug #30891)
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@173539 c90b9560-bf6c-de11-be94-00142212c4b1
2004-11-26 14:46:20 +00:00

66 lines
2.4 KiB
XML

<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.6 $ -->
<!-- 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.
</para>
<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. &false; is returned if incorrect parameters
were passed.
</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>.
</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
-->