📄 salsa_8h-source.html
字号:
<!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++: salsa.h Source File</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 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 List</span></a></li> <li><a href="globals.html"><span>File Members</span></a></li> </ul></div><h1>salsa.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">// salsa.h - written and placed in the public domain by Wei Dai</span><a name="l00002"></a>00002 <a name="l00003"></a>00003 <span class="preprocessor">#ifndef CRYPTOPP_SALSA_H</span><a name="l00004"></a>00004 <span class="preprocessor"></span><span class="preprocessor">#define CRYPTOPP_SALSA_H</span><a name="l00005"></a>00005 <span class="preprocessor"></span><a name="l00006"></a>00006 <span class="preprocessor">#include "<a class="code" href="strciphr_8h.html">strciphr.h</a>"</span><a name="l00007"></a>00007 <a name="l00008"></a>00008 NAMESPACE_BEGIN(CryptoPP)<a name="l00009"></a>00009 <a name="l00010"></a>00010 <span class="comment">//! _</span><a name="l00011"></a><a class="code" href="struct_salsa20___info.html">00011</a> <span class="comment"></span>struct <a class="code" href="struct_salsa20___info.html" title="_">Salsa20_Info</a> : public <a class="code" href="class_variable_key_length.html" title="support query of variable key length, template parameters are default, min, max,...">VariableKeyLength</a><32, 16, 32, 16, <a class="code" href="class_simple_keying_interface.html" title="keying interface for crypto algorithms that take byte strings as keys">SimpleKeyingInterface</a>::UNIQUE_IV, 8><a name="l00012"></a>00012 {<a name="l00013"></a><a class="code" href="struct_salsa20___info.html#385bea1bb87f3897062d3f37abed13e8">00013</a> <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">char</span> *StaticAlgorithmName() {<span class="keywordflow">return</span> <span class="stringliteral">"Salsa20"</span>;}<a name="l00014"></a>00014 };<a name="l00015"></a>00015 <a name="l00016"></a><a class="code" href="class_salsa20___policy.html">00016</a> <span class="keyword">class </span>CRYPTOPP_NO_VTABLE <a class="code" href="class_salsa20___policy.html">Salsa20_Policy</a> : <span class="keyword">public</span> <a class="code" href="struct_additive_cipher_concrete_policy.html">AdditiveCipherConcretePolicy</a><word32, 16>, <span class="keyword">public</span> <a class="code" href="struct_salsa20___info.html" title="_">Salsa20_Info</a><a name="l00017"></a>00017 {<a name="l00018"></a>00018 <span class="keyword">protected</span>:<a name="l00019"></a>00019 <span class="keywordtype">void</span> CipherSetKey(<span class="keyword">const</span> <a class="code" href="class_name_value_pairs.html" title="interface for retrieving values given their names">NameValuePairs</a> &params, <span class="keyword">const</span> byte *key, <span class="keywordtype">size_t</span> length);<a name="l00020"></a>00020 <span class="keywordtype">void</span> OperateKeystream(<a class="code" href="strciphr_8h.html#b4a226527d2bd01ff19bfa14d0974227">KeystreamOperation</a> operation, byte *output, <span class="keyword">const</span> byte *input, <span class="keywordtype">size_t</span> iterationCount);<a name="l00021"></a>00021 <span class="keywordtype">void</span> CipherResynchronize(byte *keystreamBuffer, <span class="keyword">const</span> byte *IV);<a name="l00022"></a><a class="code" href="class_salsa20___policy.html#5e40ec70020d78a5a454fa2a448e0ad4">00022</a> <span class="keywordtype">bool</span> IsRandomAccess()<span class="keyword"> const </span>{<span class="keywordflow">return</span> <span class="keyword">true</span>;}<a name="l00023"></a>00023 <span class="keywordtype">void</span> SeekToIteration(lword iterationCount);<a name="l00024"></a>00024 <span class="preprocessor">#if CRYPTOPP_BOOL_X86 || CRYPTOPP_BOOL_X64</span><a name="l00025"></a>00025 <span class="preprocessor"></span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="struct_additive_cipher_concrete_policy.html#5bdc1cb44b0ddc8df0fb6953aec93602">GetAlignment</a>() <span class="keyword">const</span>;<a name="l00026"></a>00026 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> GetOptimalBlockSize() <span class="keyword">const</span>;<a name="l00027"></a>00027 <span class="preprocessor">#endif</span><a name="l00028"></a>00028 <span class="preprocessor"></span><a name="l00029"></a>00029 <span class="keyword">private</span>:<a name="l00030"></a>00030 <a class="code" href="class_fixed_size_aligned_sec_block.html">FixedSizeAlignedSecBlock<word32, 16></a> m_state;<a name="l00031"></a>00031 <span class="keywordtype">int</span> m_rounds;<a name="l00032"></a>00032 };<a name="l00033"></a>00033 <span class="comment"></span><a name="l00034"></a>00034 <span class="comment">/// <a href="http://www.cryptolounge.org/wiki/Salsa20">Salsa20</a>, variable rounds: 8, 12 or 20 (default 20)</span><a name="l00035"></a><a class="code" href="struct_salsa20.html">00035</a> <span class="comment"></span><span class="keyword">struct </span><a class="code" href="struct_salsa20.html" title="Salsa20, variable rounds: 8, 12 or 20 (default 20)">Salsa20</a> : <span class="keyword">public</span> <a class="code" href="struct_salsa20___info.html" title="_">Salsa20_Info</a>, <span class="keyword">public</span> <a class="code" href="struct_symmetric_cipher_documentation.html" title="Each class derived from this one defines two types, Encryption and Decryption, both...">SymmetricCipherDocumentation</a><a name="l00036"></a>00036 {<a name="l00037"></a><a class="code" href="struct_salsa20.html#fd19ece998349d70ad9a9dfc31bf2718">00037</a> <span class="keyword">typedef</span> <a class="code" href="class_symmetric_cipher_final.html" title="_">SymmetricCipherFinal<ConcretePolicyHolder<Salsa20_Policy, AdditiveCipherTemplate<></a> >, <a class="code" href="struct_salsa20___info.html" title="_">Salsa20_Info</a>> <a class="code" href="class_symmetric_cipher_final.html" title="_">Encryption</a>;<a name="l00038"></a><a class="code" href="struct_salsa20.html#2daea7c39af63c821da7d3a5caca7ae0">00038</a> <span class="keyword">typedef</span> <a class="code" href="class_symmetric_cipher_final.html" title="_">Encryption</a> <a class="code" href="class_symmetric_cipher_final.html" title="_">Decryption</a>;<a name="l00039"></a>00039 };<a name="l00040"></a>00040 <a name="l00041"></a>00041 NAMESPACE_END<a name="l00042"></a>00042 <a name="l00043"></a>00043 <span class="preprocessor">#endif</span></pre></div><hr size="1"><address style="text-align: right;"><small>Generated on Fri Jun 1 11:11:24 2007 for Crypto++ by <a href="http://www.doxygen.org/index.html"><img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.2 </small></address></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -