mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-19 10:28:54 +00:00

The original patch has been provided by Leigh. I made some minor improvements. git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@341620 c90b9560-bf6c-de11-be94-00142212c4b1
103 lines
3.1 KiB
XML
103 lines
3.1 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- $Revision$ -->
|
|
<refentry xml:id="function.mcrypt-generic-init" xmlns="http://docbook.org/ns/docbook">
|
|
<refnamediv>
|
|
<refname>mcrypt_generic_init</refname>
|
|
<refpurpose>This function initializes all buffers needed for encryption</refpurpose>
|
|
</refnamediv>
|
|
<refsynopsisdiv>
|
|
&warn.deprecated.function-7-1-0;
|
|
</refsynopsisdiv>
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<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>
|
|
You need to call this function before every call to
|
|
<function>mcrypt_generic</function> or
|
|
<function>mdecrypt_generic</function>.
|
|
</para>
|
|
</refsect1>
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>td</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
The encryption descriptor.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>key</parameter></term>
|
|
<listitem>
|
|
<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.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>iv</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
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>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<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>
|
|
</refsect1>
|
|
<refsect1 role="seealso">
|
|
&reftitle.seealso;
|
|
<para>
|
|
<simplelist>
|
|
<member><function>mcrypt_module_open</function></member>
|
|
</simplelist>
|
|
</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:"~/.phpdoc/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
|
|
-->
|