function.mcrypt-generic-init.html
来自「php的帮助文档,涉及到PHP的案例和基本语法,以及实际应用内容」· HTML 代码 · 共 120 行
HTML
120 行
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html> <head> <title>This function initializes all buffers needed for encryption</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> </head> <body><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.mcrypt-generic-end.html">mcrypt_generic_end</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.mcrypt-generic.html">mcrypt_generic</a></div> <div class="up"><a href="ref.mcrypt.html">Mcrypt Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div><hr /><div id="function.mcrypt-generic-init" class="refentry"> <div class="refnamediv"> <h1 class="refname">mcrypt_generic_init</h1> <p class="verinfo">(PHP 4 >= 4.0.2, PHP 5)</p><p class="refpurpose"><span class="refname">mcrypt_generic_init</span> — <span class="dc-title">This function initializes all buffers needed for encryption</span></p> </div> <div class="refsect1 description"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="type">int</span> <span class="methodname"><b><b>mcrypt_generic_init</b></b></span> ( <span class="methodparam"><span class="type">resource</span> <tt class="parameter">$td</tt></span> , <span class="methodparam"><span class="type">string</span> <tt class="parameter">$key</tt></span> , <span class="methodparam"><span class="type">string</span> <tt class="parameter">$iv</tt></span> )</div> <p class="para rdfs-comment"> You need to call this function before every call to <a href="function.mcrypt-generic.html" class="function">mcrypt_generic()</a> or <a href="function.mdecrypt-generic.html" class="function">mdecrypt_generic()</a>. </p> </div> <div class="refsect1 parameters"> <h3 class="title">Parameters</h3> <p class="para"> <dl> <dt> <span class="term"><i><tt class="parameter">td</tt></i></span> <dd> <p class="para"> The encryption descriptor. </p> </dd> </dt> <dt> <span class="term"><i><tt class="parameter">key</tt></i></span> <dd> <p class="para"> The maximum length of the key should be the one obtained by calling <a href="function.mcrypt-enc-get-key-size.html" class="function">mcrypt_enc_get_key_size()</a> and every value smaller than this is legal. </p> </dd> </dt> <dt> <span class="term"><i><tt class="parameter">iv</tt></i></span> <dd> <p class="para"> The IV should normally have the size of the algorithms block size, but you must obtain the size by calling <a href="function.mcrypt-enc-get-iv-size.html" class="function">mcrypt_enc_get_iv_size()</a>. 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> </dt> </dl> </p> </div> <div class="refsect1 returnvalues"> <h3 class="title">Return Values</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. <b><tt>FALSE</tt></b> is returned if incorrect parameters were passed. </p> </div> <div class="refsect1 seealso"> <h3 class="title">See Also</h3> <p class="para"> <ul class="simplelist"> <li class="member"><a href="function.mcrypt-module-open.html" class="function" rel="rdfs-seeAlso">mcrypt_module_open()</a></li> </ul> </p> </div></div><hr /><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.mcrypt-generic-end.html">mcrypt_generic_end</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.mcrypt-generic.html">mcrypt_generic</a></div> <div class="up"><a href="ref.mcrypt.html">Mcrypt Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div></body></html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?