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

📄 arc4_8h-source.html

📁 Crypto++是一个非常强大的密码学库,主要是功能全
💻 HTML
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"><title>Crypto++: arc4.h Source File</title><link href="doxygen.css" rel="stylesheet" type="text/css"></head><body><!-- Generated by Doxygen 1.3.2 --><div class="qindex"><a class="qindex" href="index.html">Main&nbsp;Page</a> | <a class="qindex" href="namespaces.html">Namespace List</a> | <a class="qindex" href="hierarchy.html">Class&nbsp;Hierarchy</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Compound&nbsp;List</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="namespacemembers.html">Namespace&nbsp;Members</a> | <a class="qindex" href="functions.html">Compound&nbsp;Members</a> | <a class="qindex" href="globals.html">File&nbsp;Members</a></div><h1>arc4.h</h1><div class="fragment"><pre>00001 <span class="preprocessor">#ifndef CRYPTOPP_ARC4_H</span>00002 <span class="preprocessor"></span><span class="preprocessor">#define CRYPTOPP_ARC4_H</span>00003 <span class="preprocessor"></span>00004 <span class="preprocessor">#include "<a class="code" href="strciphr_8h.html">strciphr.h</a>"</span>00005 00006 NAMESPACE_BEGIN(CryptoPP)00007 00008 <span class="comment">//! &lt;a href="http://www.weidai.com/scan-mirror/cs.html#RC4"&gt;Alleged RC4&lt;/a&gt;</span>00009 <span class="comment"></span><span class="comment">/*! You can #ARC4 typedef rather than this class directly. */</span><a name="l00010"></a><a class="code" href="class_a_r_c4___base.html">00010</a> <span class="keyword">class </span><a class="code" href="class_a_r_c4___base.html">ARC4_Base</a> : <span class="keyword">public</span> <a class="code" href="class_variable_key_length.html">VariableKeyLength</a>&lt;16, 1, 256&gt;, <span class="keyword">public</span> <a class="code" href="class_random_number_generator.html">RandomNumberGenerator</a>, <span class="keyword">public</span> <a class="code" href="class_symmetric_cipher.html">SymmetricCipher</a>00011 {00012 <span class="keyword">public</span>:00013         ~<a class="code" href="class_a_r_c4___base.html">ARC4_Base</a>();00014 00015         <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">char</span> *StaticAlgorithmName() {<span class="keywordflow">return</span> <span class="stringliteral">"ARC4"</span>;}00016 00017     byte <a class="code" href="class_a_r_c4___base.html#_m_a_r_c4___basea0">GenerateByte</a>();00018         <span class="keywordtype">void</span> <a class="code" href="class_a_r_c4___base.html#_m_a_r_c4___basea1">DiscardBytes</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> n);00019 00020     <span class="keywordtype">void</span> <a class="code" href="class_a_r_c4___base.html#_m_a_r_c4___basea2">ProcessData</a>(byte *outString, <span class="keyword">const</span> byte *inString, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> length);00021         <a name="l00022"></a><a class="code" href="class_a_r_c4___base.html#_m_a_r_c4___basea3">00022</a>         <span class="keywordtype">bool</span> <a class="code" href="class_a_r_c4___base.html#_m_a_r_c4___basea3">IsRandomAccess</a>()<span class="keyword"> const </span>{<span class="keywordflow">return</span> <span class="keyword">false</span>;}<a name="l00023"></a><a class="code" href="class_a_r_c4___base.html#_m_a_r_c4___basea4">00023</a>         <span class="keywordtype">bool</span> <a class="code" href="class_a_r_c4___base.html#_m_a_r_c4___basea4">IsSelfInverting</a>()<span class="keyword"> const </span>{<span class="keywordflow">return</span> <span class="keyword">true</span>;}<a name="l00024"></a><a class="code" href="class_a_r_c4___base.html#_m_a_r_c4___basea5">00024</a>         <span class="keywordtype">bool</span> <a class="code" href="class_a_r_c4___base.html#_m_a_r_c4___basea5">IsForwardTransformation</a>()<span class="keyword"> const </span>{<span class="keywordflow">return</span> <span class="keyword">true</span>;}00025 00026         <span class="keyword">typedef</span> SymmetricCipherFinalTemplate&lt;ARC4_Base&gt; Encryption;00027         <span class="keyword">typedef</span> SymmetricCipherFinalTemplate&lt;ARC4_Base&gt; Decryption;00028 00029 <span class="keyword">protected</span>:00030         <span class="keywordtype">void</span> UncheckedSetKey(<span class="keyword">const</span> <a class="code" href="class_name_value_pairs.html">NameValuePairs</a> &amp;params, <span class="keyword">const</span> byte *key, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> length);00031         <span class="keyword">virtual</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> GetDefaultDiscardBytes()<span class="keyword"> const </span>{<span class="keywordflow">return</span> 0;}00032 00033     FixedSizeSecBlock&lt;byte, 256&gt; m_state;00034     byte m_x, m_y;00035 };00036 <span class="comment"></span>00037 <span class="comment">//! .</span>00038 <span class="comment"></span><span class="keyword">typedef</span> SymmetricCipherFinalTemplate&lt;ARC4_Base&gt; ARC4;00039 <span class="comment"></span><a name="l00040"></a><a class="code" href="class_m_a_r_c4___base.html">00040</a> <span class="comment">//! Modified ARC4: it discards the first 256 bytes of keystream which may be weaker than the rest</span>00041 <span class="comment"></span><span class="comment">/*! You can #MARC4 typedef rather than this class directly. */</span>00042 <span class="keyword">class </span><a class="code" href="class_m_a_r_c4___base.html">MARC4_Base</a> : <span class="keyword">public</span> <a class="code" href="class_a_r_c4___base.html">ARC4_Base</a>00043 {00044 <span class="keyword">public</span>:00045         <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">char</span> *StaticAlgorithmName() {<span class="keywordflow">return</span> <span class="stringliteral">"MARC4"</span>;}00046 00047         <span class="keyword">typedef</span> SymmetricCipherFinalTemplate&lt;MARC4_Base&gt; Encryption;00048         <span class="keyword">typedef</span> SymmetricCipherFinalTemplate&lt;MARC4_Base&gt; Decryption;00049 00050 <span class="keyword">protected</span>:00051         <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> GetDefaultDiscardBytes()<span class="keyword"> const </span>{<span class="keywordflow">return</span> 256;}00052 };00053 <span class="comment"></span>00054 <span class="comment">//! .</span>00055 <span class="comment"></span><span class="keyword">typedef</span> SymmetricCipherFinalTemplate&lt;MARC4_Base&gt; MARC4;00056 00057 NAMESPACE_END00058 00059 <span class="preprocessor">#endif</span></pre></div><hr size="1"><address style="align: right;"><small>Generated on Tue Jul 8 23:34:08 2003 for Crypto++ by<a href="http://www.doxygen.org/index.html"><img src="doxygen.png" alt="doxygen" align="middle" border=0 > </a>1.3.2 </small></address></body></html>

⌨️ 快捷键说明

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