📄 arc4_8h-source.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 Page</a> | <a class="qindex" href="namespaces.html">Namespace List</a> | <a class="qindex" href="hierarchy.html">Class Hierarchy</a> | <a class="qindex" href="classes.html">Alphabetical List</a> | <a class="qindex" href="annotated.html">Compound List</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="namespacemembers.html">Namespace Members</a> | <a class="qindex" href="functions.html">Compound Members</a> | <a class="qindex" href="globals.html">File 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">//! <a href="http://www.weidai.com/scan-mirror/cs.html#RC4">Alleged RC4</a></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><16, 1, 256>, <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<ARC4_Base> Encryption;00027 <span class="keyword">typedef</span> SymmetricCipherFinalTemplate<ARC4_Base> 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> &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<byte, 256> 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<ARC4_Base> 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<MARC4_Base> Encryption;00048 <span class="keyword">typedef</span> SymmetricCipherFinalTemplate<MARC4_Base> 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<MARC4_Base> 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 + -