📄 function.mcrypt-get-iv-size.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html> <head> <title>Returns the size of the IV belonging to a specific cipher/mode combination</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-get-cipher-name.html">mcrypt_get_cipher_name</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.mcrypt-get-key-size.html">mcrypt_get_key_size</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-get-iv-size" class="refentry"> <div class="refnamediv"> <h1 class="refname">mcrypt_get_iv_size</h1> <p class="verinfo">(PHP 4 >= 4.0.2, PHP 5)</p><p class="refpurpose"><span class="refname">mcrypt_get_iv_size</span> — <span class="dc-title">Returns the size of the IV belonging to a specific cipher/mode combination</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_get_iv_size</b></b></span> ( <span class="methodparam"><span class="type">string</span> <tt class="parameter">$cipher</tt></span> , <span class="methodparam"><span class="type">string</span> <tt class="parameter">$mode</tt></span> )</div> <p class="para rdfs-comment"> <b>mcrypt_get_iv_size()</b> returns the size of the Initialisation Vector (IV) in bytes. On error the function returns <b><tt>FALSE</tt></b>. If the IV is ignored in the specified cipher/mode combination zero is returned. </p> <p class="para"> <i><tt class="parameter">cipher</tt></i> is one of the MCRYPT_ciphername constants of the name of the algorithm as string. </p> <p class="para"> <i><tt class="parameter">mode</tt></i> is one of the MCRYPT_MODE_modename constants or one of "ecb", "cbc", "cfb", "ofb", "nofb" or "stream". The IV is ignored in ECB mode as this mode does not require it. You will need to have the same IV (think: starting point) both at encryption and decryption stages, otherwise your encryption will fail. </p> <p class="para"> It is more useful to use the <a href="function.mcrypt-enc-get-iv-size.html" class="function">mcrypt_enc_get_iv_size()</a> function as this uses the resource returned by <a href="function.mcrypt-module-open.html" class="function">mcrypt_module_open()</a>. </p> </div> <div class="refsect1 examples"> <h3 class="title">Examples</h3> <p class="para"> <div class="example"> <p><b>Example #1 <b>mcrypt_get_iv_size()</b> example</b></p> <div class="example-contents"><div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB"><?php<br /> </span><span style="color: #007700">echo </span><span style="color: #0000BB">mcrypt_get_iv_size</span><span style="color: #007700">(</span><span style="color: #0000BB">MCRYPT_CAST_256</span><span style="color: #007700">, </span><span style="color: #0000BB">MCRYPT_MODE_CFB</span><span style="color: #007700">) . </span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br /><br /> echo </span><span style="color: #0000BB">mcrypt_get_iv_size</span><span style="color: #007700">(</span><span style="color: #DD0000">'des'</span><span style="color: #007700">, </span><span style="color: #DD0000">'ecb'</span><span style="color: #007700">) . </span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">?></span></span></code></div> </div> </div> </p> <p class="para"> See also <a href="function.mcrypt-get-block-size.html" class="function">mcrypt_get_block_size()</a>, <a href="function.mcrypt-enc-get-iv-size.html" class="function">mcrypt_enc_get_iv_size()</a> and <a href="function.mcrypt-create-iv.html" class="function">mcrypt_create_iv()</a>. </p> </div></div><hr /><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.mcrypt-get-cipher-name.html">mcrypt_get_cipher_name</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.mcrypt-get-key-size.html">mcrypt_get_key_size</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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -