<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <meta http-equiv="X-UA-Compatible" content="IE=9"/> <meta name="generator" content="Doxygen 1.8.14"/> <meta name="viewport" content="width=device-width, initial-scale=1"/> <title>Crypto++: serpent.h Source File</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="dynsections.js"></script> <link href="doxygen.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="top"><!-- do not remove this div, it is closed by doxygen! --> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td id="projectalign" style="padding-left: 0.5em;"> <div id="projectname">Crypto++  <span id="projectnumber">7.0</span> </div> <div id="projectbrief">Free C++ class library of cryptographic schemes</div> </td> </tr> </tbody> </table> </div> <!-- end header part --> <!-- Generated by Doxygen 1.8.14 --> <script type="text/javascript" src="menudata.js"></script> <script type="text/javascript" src="menu.js"></script> <script type="text/javascript"> /* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */ $(function() { initMenu('',false,false,'search.php','Search'); }); /* @license-end */</script> <div id="main-nav"></div> </div><!-- top --> <div class="header"> <div class="headertitle"> <div class="title">serpent.h</div> </div> </div><!--header--> <div class="contents"> <a href="serpent_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span> <span class="comment">// serpent.h - originally written and placed in the public domain by Wei Dai</span></div><div class="line"><a name="l00002"></a><span class="lineno"> 2</span> <span class="comment"></span></div><div class="line"><a name="l00003"></a><span class="lineno"> 3</span> <span class="comment">/// \file serpent.h</span></div><div class="line"><a name="l00004"></a><span class="lineno"> 4</span> <span class="comment">/// \brief Classes for the Serpent block cipher</span></div><div class="line"><a name="l00005"></a><span class="lineno"> 5</span> <span class="comment"></span></div><div class="line"><a name="l00006"></a><span class="lineno"> 6</span> <span class="preprocessor">#ifndef CRYPTOPP_SERPENT_H</span></div><div class="line"><a name="l00007"></a><span class="lineno"> 7</span> <span class="preprocessor">#define CRYPTOPP_SERPENT_H</span></div><div class="line"><a name="l00008"></a><span class="lineno"> 8</span> </div><div class="line"><a name="l00009"></a><span class="lineno"> 9</span> <span class="preprocessor">#include "<a class="code" href="seckey_8h.html">seckey.h</a>"</span></div><div class="line"><a name="l00010"></a><span class="lineno"> 10</span> <span class="preprocessor">#include "<a class="code" href="secblock_8h.html">secblock.h</a>"</span></div><div class="line"><a name="l00011"></a><span class="lineno"> 11</span> </div><div class="line"><a name="l00012"></a><span class="lineno"> 12</span> NAMESPACE_BEGIN(<a class="code" href="namespace_crypto_p_p.html">CryptoPP</a>)</div><div class="line"><a name="l00013"></a><span class="lineno"> 13</span> </div><div class="line"><a name="l00014"></a><span class="lineno"> 14</span> <span class="comment">/// \brief Serpent block cipher information</span></div><div class="line"><a name="l00015"></a><span class="lineno"> 15</span> <span class="comment"></span><span class="comment">/// \since Crypto++ 3.1</span></div><div class="line"><a name="l00016"></a><span class="lineno"><a class="line" href="struct_serpent___info.html"> 16</a></span> <span class="comment"></span>struct <a class="code" href="struct_serpent___info.html">Serpent_Info</a> : public <a class="code" href="class_fixed_block_size.html">FixedBlockSize</a><16>, public <a class="code" href="class_variable_key_length.html">VariableKeyLength</a><16, 16, 32, 8>, public <a class="code" href="class_fixed_rounds.html">FixedRounds</a><32></div><div class="line"><a name="l00017"></a><span class="lineno"> 17</span> {</div><div class="line"><a name="l00018"></a><span class="lineno"> 18</span>  CRYPTOPP_STATIC_CONSTEXPR <span class="keyword">const</span> <span class="keywordtype">char</span>* StaticAlgorithmName() {<span class="keywordflow">return</span> <span class="stringliteral">"Serpent"</span>;}</div><div class="line"><a name="l00019"></a><span class="lineno"> 19</span> };</div><div class="line"><a name="l00020"></a><span class="lineno"> 20</span> <span class="comment"></span></div><div class="line"><a name="l00021"></a><span class="lineno"> 21</span> <span class="comment">/// \brief Serpent block cipher</span></div><div class="line"><a name="l00022"></a><span class="lineno"> 22</span> <span class="comment">/// \sa <a href="http://www.cryptopp.com/wiki/Serpent">Serpent</a></span></div><div class="line"><a name="l00023"></a><span class="lineno"> 23</span> <span class="comment">/// \since Crypto++ 3.1</span></div><div class="line"><a name="l00024"></a><span class="lineno"><a class="line" href="class_serpent.html"> 24</a></span> <span class="comment"></span><span class="keyword">class </span><a class="code" href="class_serpent.html">Serpent</a> : <span class="keyword">public</span> <a class="code" href="struct_serpent___info.html">Serpent_Info</a>, <span class="keyword">public</span> <a class="code" href="struct_block_cipher_documentation.html">BlockCipherDocumentation</a></div><div class="line"><a name="l00025"></a><span class="lineno"> 25</span> {</div><div class="line"><a name="l00026"></a><span class="lineno"> 26</span>  <span class="keyword">class </span>CRYPTOPP_NO_VTABLE Base : <span class="keyword">public</span> <a class="code" href="class_block_cipher_impl.html">BlockCipherImpl</a><Serpent_Info></div><div class="line"><a name="l00027"></a><span class="lineno"> 27</span>  {</div><div class="line"><a name="l00028"></a><span class="lineno"> 28</span>  <span class="keyword">public</span>:</div><div class="line"><a name="l00029"></a><span class="lineno"> 29</span>  <span class="keywordtype">void</span> UncheckedSetKey(<span class="keyword">const</span> byte *userKey, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> length, <span class="keyword">const</span> <a class="code" href="class_name_value_pairs.html">NameValuePairs</a> &params);</div><div class="line"><a name="l00030"></a><span class="lineno"> 30</span> </div><div class="line"><a name="l00031"></a><span class="lineno"> 31</span>  <span class="keyword">protected</span>:</div><div class="line"><a name="l00032"></a><span class="lineno"> 32</span>  <a class="code" href="class_fixed_size_sec_block.html">FixedSizeSecBlock<word32, 33*4></a> m_key;</div><div class="line"><a name="l00033"></a><span class="lineno"> 33</span>  };</div><div class="line"><a name="l00034"></a><span class="lineno"> 34</span> </div><div class="line"><a name="l00035"></a><span class="lineno"> 35</span>  <span class="keyword">class </span>CRYPTOPP_NO_VTABLE Enc : <span class="keyword">public</span> Base</div><div class="line"><a name="l00036"></a><span class="lineno"> 36</span>  {</div><div class="line"><a name="l00037"></a><span class="lineno"> 37</span>  <span class="keyword">public</span>:</div><div class="line"><a name="l00038"></a><span class="lineno"> 38</span>  <span class="keywordtype">void</span> ProcessAndXorBlock(<span class="keyword">const</span> byte *inBlock, <span class="keyword">const</span> byte *xorBlock, byte *outBlock) <span class="keyword">const</span>;</div><div class="line"><a name="l00039"></a><span class="lineno"> 39</span>  };</div><div class="line"><a name="l00040"></a><span class="lineno"> 40</span> </div><div class="line"><a name="l00041"></a><span class="lineno"> 41</span>  <span class="keyword">class </span>CRYPTOPP_NO_VTABLE Dec : <span class="keyword">public</span> Base</div><div class="line"><a name="l00042"></a><span class="lineno"> 42</span>  {</div><div class="line"><a name="l00043"></a><span class="lineno"> 43</span>  <span class="keyword">public</span>:</div><div class="line"><a name="l00044"></a><span class="lineno"> 44</span>  <span class="keywordtype">void</span> ProcessAndXorBlock(<span class="keyword">const</span> byte *inBlock, <span class="keyword">const</span> byte *xorBlock, byte *outBlock) <span class="keyword">const</span>;</div><div class="line"><a name="l00045"></a><span class="lineno"> 45</span>  };</div><div class="line"><a name="l00046"></a><span class="lineno"> 46</span> </div><div class="line"><a name="l00047"></a><span class="lineno"> 47</span> <span class="keyword">public</span>:</div><div class="line"><a name="l00048"></a><span class="lineno"> 48</span>  <span class="keyword">typedef</span> <a class="code" href="class_block_cipher_final.html">BlockCipherFinal<ENCRYPTION, Enc></a> <a class="code" href="class_block_cipher.html">Encryption</a>;</div><div class="line"><a name="l00049"></a><span class="lineno"> 49</span>  <span class="keyword">typedef</span> <a class="code" href="class_block_cipher_final.html">BlockCipherFinal<DECRYPTION, Dec></a> <a class="code" href="class_block_cipher.html">Decryption</a>;</div><div class="line"><a name="l00050"></a><span class="lineno"> 50</span> };</div><div class="line"><a name="l00051"></a><span class="lineno"> 51</span> </div><div class="line"><a name="l00052"></a><span class="lineno"> 52</span> <span class="keyword">typedef</span> <a class="code" href="class_block_cipher_final.html">Serpent::Encryption</a> <a class="code" href="class_block_cipher_final.html">SerpentEncryption</a>;</div><div class="line"><a name="l00053"></a><span class="lineno"> 53</span> <span class="keyword">typedef</span> <a class="code" href="class_block_cipher_final.html">Serpent::Decryption</a> <a class="code" href="class_block_cipher_final.html">SerpentDecryption</a>;</div><div class="line"><a name="l00054"></a><span class="lineno"> 54</span> </div><div class="line"><a name="l00055"></a><span class="lineno"> 55</span> NAMESPACE_END</div><div class="line"><a name="l00056"></a><span class="lineno"> 56</span> </div><div class="line"><a name="l00057"></a><span class="lineno"> 57</span> <span class="preprocessor">#endif</span></div><div class="ttc" id="struct_block_cipher_documentation_html"><div class="ttname"><a href="struct_block_cipher_documentation.html">BlockCipherDocumentation</a></div><div class="ttdoc">Provides Encryption and Decryption typedefs used by derived classes to implement a block cipher...</div><div class="ttdef"><b>Definition:</b> <a href="seckey_8h_source.html#l00420">seckey.h:420</a></div></div> <div class="ttc" id="class_serpent_html"><div class="ttname"><a href="class_serpent.html">Serpent</a></div><div class="ttdoc">Serpent block cipher. </div><div class="ttdef"><b>Definition:</b> <a href="serpent_8h_source.html#l00024">serpent.h:24</a></div></div> <div class="ttc" id="class_block_cipher_html"><div class="ttname"><a href="class_block_cipher.html">BlockCipher</a></div><div class="ttdoc">Interface for one direction (encryption or decryption) of a block cipher. </div><div class="ttdef"><b>Definition:</b> <a href="cryptlib_8h_source.html#l01229">cryptlib.h:1229</a></div></div> <div class="ttc" id="secblock_8h_html"><div class="ttname"><a href="secblock_8h.html">secblock.h</a></div><div class="ttdoc">Classes and functions for secure memory allocations. </div></div> <div class="ttc" id="class_fixed_block_size_html"><div class="ttname"><a href="class_fixed_block_size.html">FixedBlockSize</a></div><div class="ttdoc">Inherited by algorithms with fixed block size. </div><div class="ttdef"><b>Definition:</b> <a href="seckey_8h_source.html#l00040">seckey.h:40</a></div></div> <div class="ttc" id="seckey_8h_html"><div class="ttname"><a href="seckey_8h.html">seckey.h</a></div><div class="ttdoc">Classes and functions for implementing secret key algorithms. </div></div> <div class="ttc" id="class_block_cipher_final_html"><div class="ttname"><a href="class_block_cipher_final.html">BlockCipherFinal< ENCRYPTION, Enc ></a></div></div> <div class="ttc" id="class_fixed_size_sec_block_html"><div class="ttname"><a href="class_fixed_size_sec_block.html">FixedSizeSecBlock< word32, 33 *4 ></a></div></div> <div class="ttc" id="class_fixed_rounds_html"><div class="ttname"><a href="class_fixed_rounds.html">FixedRounds</a></div><div class="ttdoc">Inherited by algorithms with fixed number of rounds. </div><div class="ttdef"><b>Definition:</b> <a href="seckey_8h_source.html#l00075">seckey.h:75</a></div></div> <div class="ttc" id="class_variable_key_length_html"><div class="ttname"><a href="class_variable_key_length.html">VariableKeyLength</a></div><div class="ttdoc">Inherited by keyed algorithms with variable key length. </div><div class="ttdef"><b>Definition:</b> <a href="seckey_8h_source.html#l00188">seckey.h:188</a></div></div> <div class="ttc" id="struct_serpent___info_html"><div class="ttname"><a href="struct_serpent___info.html">Serpent_Info</a></div><div class="ttdoc">Serpent block cipher information. </div><div class="ttdef"><b>Definition:</b> <a href="serpent_8h_source.html#l00016">serpent.h:16</a></div></div> <div class="ttc" id="class_block_cipher_impl_html"><div class="ttname"><a href="class_block_cipher_impl.html">BlockCipherImpl</a></div><div class="ttdoc">Provides a base implementation of Algorithm and SimpleKeyingInterface for block ciphers. </div><div class="ttdef"><b>Definition:</b> <a href="seckey_8h_source.html#l00327">seckey.h:327</a></div></div> <div class="ttc" id="namespace_crypto_p_p_html"><div class="ttname"><a href="namespace_crypto_p_p.html">CryptoPP</a></div><div class="ttdoc">Crypto++ library namespace. </div></div> <div class="ttc" id="class_name_value_pairs_html"><div class="ttname"><a href="class_name_value_pairs.html">NameValuePairs</a></div><div class="ttdoc">Interface for retrieving values given their names. </div><div class="ttdef"><b>Definition:</b> <a href="cryptlib_8h_source.html#l00290">cryptlib.h:290</a></div></div> </div><!-- fragment --></div><!-- contents --> <!-- start footer part --> <hr class="footer"/><address class="footer"><small> Generated on Sun Sep 16 2018 07:58:03 for Crypto++ by  <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/> </a> 1.8.14 </small></address> </body> </html>