⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 strciphr_8h.html

📁 著名的密码库Crypto++的文档 C++语言的杰作。程序员必备。
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"><title>Crypto++: strciphr.h File Reference</title><link href="doxygen.css" rel="stylesheet" type="text/css"><link href="tabs.css" rel="stylesheet" type="text/css"></head><body><!-- Generated by Doxygen 1.5.2 --><div class="tabs">  <ul>    <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>    <li><a href="namespaces.html"><span>Namespaces</span></a></li>    <li><a href="classes.html"><span>Classes</span></a></li>    <li class="current"><a href="files.html"><span>Files</span></a></li>  </ul></div><div class="tabs">  <ul>    <li><a href="files.html"><span>File&nbsp;List</span></a></li>    <li><a href="globals.html"><span>File&nbsp;Members</span></a></li>  </ul></div><h1>strciphr.h File Reference</h1><hr><a name="_details"></a><h2>Detailed Description</h2>This file contains helper classes for implementing stream ciphers.<p>All this infrastructure may look very complex compared to what's in Crypto++ 4.x, but stream ciphers implementations now support a lot of new functionality, including better performance (minimizing copying), resetting of keys and IVs, and methods to query which features are supported by a cipher.<p>Here's an explanation of these classes. The word "policy" is used here to mean a class with a set of methods that must be implemented by individual stream cipher implementations. This is usually much simpler than the full stream cipher API, which is implemented by either <a class="el" href="class_additive_cipher_template.html">AdditiveCipherTemplate</a> or <a class="el" href="class_c_f_b___cipher_template.html">CFB_CipherTemplate</a> using the policy. So for example, an implementation of <a class="el" href="struct_s_e_a_l.html" title="SEAL">SEAL</a> only needs to implement the <a class="el" href="struct_additive_cipher_abstract_policy.html">AdditiveCipherAbstractPolicy</a> interface (since it's an additive cipher, i.e., it xors a keystream into the plaintext). See this line in <a class="el" href="seal_8h-source.html">seal.h</a>:<p>typedef <a class="el" href="class_symmetric_cipher_final.html" title="_">SymmetricCipherFinal</a>&lt;<a class="el" href="class_concrete_policy_holder.html">ConcretePolicyHolder</a>&lt;<a class="el" href="class_s_e_a_l___policy.html">SEAL_Policy</a>&lt;B&gt;, <a class="el" href="class_additive_cipher_template.html">AdditiveCipherTemplate</a>&lt;&gt; &gt; &gt; Encryption;<p><a class="el" href="class_additive_cipher_template.html">AdditiveCipherTemplate</a> and <a class="el" href="class_c_f_b___cipher_template.html">CFB_CipherTemplate</a> are designed so that they don't need to take a policy class as a template parameter (although this is allowed), so that their code is not duplicated for each new cipher. Instead they each get a reference to an abstract policy interface by calling AccessPolicy() on itself, so AccessPolicy() must be overriden to return the actual policy reference. This is done by the ConceretePolicyHolder class. Finally, <a class="el" href="class_symmetric_cipher_final.html" title="_">SymmetricCipherFinal</a> implements the constructors and other functions that must be implemented by the most derived class. <p>Definition in file <a class="el" href="strciphr_8h-source.html">strciphr.h</a>.<p><code>#include &quot;seckey.h&quot;</code><br><code>#include &quot;secblock.h&quot;</code><br><code>#include &quot;argnames.h&quot;</code><br><code>#include &quot;strciphr.cpp&quot;</code><br><p><a href="strciphr_8h-source.html">Go to the source code of this file.</a><table border="0" cellpadding="0" cellspacing="0"><tr><td></td></tr><tr><td colspan="2"><br><h2>Classes</h2></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top">class &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_abstract_policy_holder.html">AbstractPolicyHolder&lt; POLICY_INTERFACE, BASE &gt;</a></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top">class &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_concrete_policy_holder.html">ConcretePolicyHolder&lt; POLICY, BASE, POLICY_INTERFACE &gt;</a></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top">struct &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_additive_cipher_abstract_policy.html">AdditiveCipherAbstractPolicy</a></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top">struct &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_additive_cipher_concrete_policy.html">AdditiveCipherConcretePolicy&lt; WT, W, X, BASE &gt;</a></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top">class &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_additive_cipher_template.html">AdditiveCipherTemplate&lt; BASE &gt;</a></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top">class &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_f_b___cipher_abstract_policy.html">CFB_CipherAbstractPolicy</a></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top">struct &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_c_f_b___cipher_concrete_policy.html">CFB_CipherConcretePolicy&lt; WT, W, BASE &gt;</a></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top">struct &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_c_f_b___cipher_concrete_policy_1_1_register_output.html">CFB_CipherConcretePolicy&lt; WT, W, BASE &gt;::RegisterOutput&lt; B &gt;</a></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top">class &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_f_b___cipher_template.html">CFB_CipherTemplate&lt; BASE &gt;</a></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top">class &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_f_b___encryption_template.html">CFB_EncryptionTemplate&lt; BASE &gt;</a></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top">class &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_f_b___decryption_template.html">CFB_DecryptionTemplate&lt; BASE &gt;</a></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top">class &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_f_b___require_full_data_blocks.html">CFB_RequireFullDataBlocks&lt; BASE &gt;</a></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top">class &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_symmetric_cipher_final.html">SymmetricCipherFinal&lt; BASE, INFO &gt;</a></td></tr><tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">_  <a href="class_symmetric_cipher_final.html#_details">More...</a><br></td></tr><tr><td colspan="2"><br><h2>Defines</h2></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="4a86c9df41d368440348bcc835a56706"></a><!-- doxytag: member="strciphr.h::CRYPTOPP_KEYSTREAM_OUTPUT_WORD" ref="4a86c9df41d368440348bcc835a56706" args="(x, b, i, a)" -->#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="strciphr_8h.html#4a86c9df41d368440348bcc835a56706">CRYPTOPP_KEYSTREAM_OUTPUT_WORD</a>(x, b, i, a)&nbsp;&nbsp;&nbsp;PutWord(bool(x &amp; OUTPUT_ALIGNED), b, output+i*sizeof(WordType), (x &amp; INPUT_NULL) ? a : a ^ GetWord&lt;WordType&gt;(bool(x &amp; INPUT_ALIGNED), b, input+i*sizeof(WordType)));</td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top">#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="strciphr_8h.html#3a30bda92ececdc86efced76e074eeaa">CRYPTOPP_KEYSTREAM_OUTPUT_XMM</a>(x, i, a)</td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top">#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="strciphr_8h.html#4f82514b5ab874259ac783ff9b96c4e5">CRYPTOPP_KEYSTREAM_OUTPUT_SWITCH</a>(x, y)</td></tr><tr><td colspan="2"><br><h2>Enumerations</h2></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top">enum &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="strciphr_8h.html#cd7ca957d2fd1c24ecc2a4db7145d93f">KeystreamOperationFlags</a> { <a class="el" href="strciphr_8h.html#cd7ca957d2fd1c24ecc2a4db7145d93fc940e3e878ef290eed45beb9875a04ea">OUTPUT_ALIGNED</a> = 1, <a class="el" href="strciphr_8h.html#cd7ca957d2fd1c24ecc2a4db7145d93f930b8199ed034e6d749cb403e1678cb1">INPUT_ALIGNED</a> = 2, <a class="el" href="strciphr_8h.html#cd7ca957d2fd1c24ecc2a4db7145d93f0fc3580c2832e59fe9e21673160e6042">INPUT_NULL</a> =  4 }</td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top">enum &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="strciphr_8h.html#b4a226527d2bd01ff19bfa14d0974227">KeystreamOperation</a> { <br>&nbsp;&nbsp;<a class="el" href="strciphr_8h.html#b4a226527d2bd01ff19bfa14d09742276ab40a8f816d015407f61839c60b9a4e">WRITE_KEYSTREAM</a> =  INPUT_NULL, <a class="el" href="strciphr_8h.html#b4a226527d2bd01ff19bfa14d0974227cdc514c6fefe9937a84c0394bf4d7dbb">WRITE_KEYSTREAM_ALIGNED</a> =  INPUT_NULL | OUTPUT_ALIGNED, <a class="el" href="strciphr_8h.html#b4a226527d2bd01ff19bfa14d09742273862fdc8a3c07e925d4a37ea9ee307d3">XOR_KEYSTREAM</a> =  0, <a class="el" href="strciphr_8h.html#b4a226527d2bd01ff19bfa14d0974227ad43a73f1f4e27c051c0eb38ab63fb8f">XOR_KEYSTREAM_INPUT_ALIGNED</a> =  INPUT_ALIGNED, <br>&nbsp;&nbsp;<a class="el" href="strciphr_8h.html#b4a226527d2bd01ff19bfa14d0974227c98e33dfc8a7eb9fb546d2d6dc1dce8d">XOR_KEYSTREAM_OUTPUT_ALIGNED</a> =  OUTPUT_ALIGNED, <a class="el" href="strciphr_8h.html#b4a226527d2bd01ff19bfa14d09742278619a63402bbed5800381dc04dcbc4e8">XOR_KEYSTREAM_BOTH_ALIGNED</a> =  OUTPUT_ALIGNED | INPUT_ALIGNED<br> }</td></tr></table><hr><h2>Define Documentation</h2><a class="anchor" name="3a30bda92ececdc86efced76e074eeaa"></a><!-- doxytag: member="strciphr.h::CRYPTOPP_KEYSTREAM_OUTPUT_XMM" ref="3a30bda92ececdc86efced76e074eeaa" args="(x, i, a)" --><div class="memitem"><div class="memproto">      <table class="memname">        <tr>          <td class="memname">#define CRYPTOPP_KEYSTREAM_OUTPUT_XMM          </td>          <td>(</td>          <td class="paramtype">x,         <tr>          <td class="paramkey"></td>          <td></td>          <td class="paramtype">i,         <tr>          <td class="paramkey"></td>          <td></td>          <td class="paramtype">a&nbsp;</td>          <td class="paramname">          </td>          <td>&nbsp;)&nbsp;</td>          <td width="100%"></td>        </tr>      </table></div><div class="memdoc"><p><b>Value:</b><div class="fragment"><pre class="fragment">{\        __m128i t = (x &amp; <a class="code" href="strciphr_8h.html#cd7ca957d2fd1c24ecc2a4db7145d93f0fc3580c2832e59fe9e21673160e6042">INPUT_NULL</a>) ? a : _mm_xor_si128(a, (x &amp; <a class="code" href="strciphr_8h.html#cd7ca957d2fd1c24ecc2a4db7145d93f930b8199ed034e6d749cb403e1678cb1">INPUT_ALIGNED</a>) ? _mm_load_si128((__m128i *)input+i) : _mm_loadu_si128((__m128i *)input+i));\        <span class="keywordflow">if</span> (x &amp; <a class="code" href="strciphr_8h.html#cd7ca957d2fd1c24ecc2a4db7145d93fc940e3e878ef290eed45beb9875a04ea">OUTPUT_ALIGNED</a>) _mm_store_si128((__m128i *)output+i, t);\        <span class="keywordflow">else</span> _mm_storeu_si128((__m128i *)output+i, t);}</pre></div><p>Definition at line <a class="el" href="strciphr_8h-source.html#l00100">100</a> of file <a class="el" href="strciphr_8h-source.html">strciphr.h</a>.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -