<!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++: modexppc.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">modexppc.h</div> </div> </div><!--header--> <div class="contents"> <div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span> <span class="preprocessor">#ifndef CRYPTOPP_MODEXPPC_H</span></div><div class="line"><a name="l00002"></a><span class="lineno"> 2</span> <span class="preprocessor">#define CRYPTOPP_MODEXPPC_H</span></div><div class="line"><a name="l00003"></a><span class="lineno"> 3</span> </div><div class="line"><a name="l00004"></a><span class="lineno"> 4</span> <span class="preprocessor">#include "<a class="code" href="cryptlib_8h.html">cryptlib.h</a>"</span></div><div class="line"><a name="l00005"></a><span class="lineno"> 5</span> <span class="preprocessor">#include "<a class="code" href="modarith_8h.html">modarith.h</a>"</span></div><div class="line"><a name="l00006"></a><span class="lineno"> 6</span> <span class="preprocessor">#include "<a class="code" href="integer_8h.html">integer.h</a>"</span></div><div class="line"><a name="l00007"></a><span class="lineno"> 7</span> <span class="preprocessor">#include "<a class="code" href="algebra_8h.html">algebra.h</a>"</span></div><div class="line"><a name="l00008"></a><span class="lineno"> 8</span> <span class="preprocessor">#include "<a class="code" href="eprecomp_8h.html">eprecomp.h</a>"</span></div><div class="line"><a name="l00009"></a><span class="lineno"> 9</span> <span class="preprocessor">#include "<a class="code" href="smartptr_8h.html">smartptr.h</a>"</span></div><div class="line"><a name="l00010"></a><span class="lineno"> 10</span> <span class="preprocessor">#include "<a class="code" href="pubkey_8h.html">pubkey.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> <span class="preprocessor">#if CRYPTOPP_MSC_VERSION</span></div><div class="line"><a name="l00013"></a><span class="lineno"> 13</span> <span class="preprocessor"># pragma warning(push)</span></div><div class="line"><a name="l00014"></a><span class="lineno"> 14</span> <span class="preprocessor"># pragma warning(disable: 4231 4275)</span></div><div class="line"><a name="l00015"></a><span class="lineno"> 15</span> <span class="preprocessor">#endif</span></div><div class="line"><a name="l00016"></a><span class="lineno"> 16</span> </div><div class="line"><a name="l00017"></a><span class="lineno"> 17</span> NAMESPACE_BEGIN(<a class="code" href="namespace_crypto_p_p.html">CryptoPP</a>)</div><div class="line"><a name="l00018"></a><span class="lineno"> 18</span> </div><div class="line"><a name="l00019"></a><span class="lineno"> 19</span> CRYPTOPP_DLL_TEMPLATE_CLASS <a class="code" href="class_d_l___fixed_base_precomputation_impl.html">DL_FixedBasePrecomputationImpl<Integer></a>;</div><div class="line"><a name="l00020"></a><span class="lineno"> 20</span> </div><div class="line"><a name="l00021"></a><span class="lineno"><a class="line" href="class_mod_exp_precomputation.html"> 21</a></span> <span class="keyword">class </span><a class="code" href="class_mod_exp_precomputation.html">ModExpPrecomputation</a> : <span class="keyword">public</span> <a class="code" href="class_d_l___group_precomputation.html">DL_GroupPrecomputation</a><Integer></div><div class="line"><a name="l00022"></a><span class="lineno"> 22</span> {</div><div class="line"><a name="l00023"></a><span class="lineno"> 23</span> <span class="keyword">public</span>:</div><div class="line"><a name="l00024"></a><span class="lineno"> 24</span>  <span class="keyword">virtual</span> ~<a class="code" href="class_mod_exp_precomputation.html">ModExpPrecomputation</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="comment">// DL_GroupPrecomputation</span></div><div class="line"><a name="l00027"></a><span class="lineno"><a class="line" href="class_mod_exp_precomputation.html#a4606d689b130f8fcaf156314e4837e4a"> 27</a></span>  <span class="keywordtype">bool</span> <a class="code" href="class_mod_exp_precomputation.html#a4606d689b130f8fcaf156314e4837e4a">NeedConversions</a>()<span class="keyword"> const </span>{<span class="keywordflow">return</span> <span class="keyword">true</span>;}</div><div class="line"><a name="l00028"></a><span class="lineno"><a class="line" href="class_mod_exp_precomputation.html#a5e06496338c37c44bfd31ad96eff5866"> 28</a></span>  <a class="code" href="class_integer.html">Element</a> <a class="code" href="class_mod_exp_precomputation.html#a5e06496338c37c44bfd31ad96eff5866">ConvertIn</a>(<span class="keyword">const</span> <a class="code" href="class_integer.html">Element</a> &v)<span class="keyword"> const </span>{<span class="keywordflow">return</span> m_mr->ConvertIn(v);}</div><div class="line"><a name="l00029"></a><span class="lineno"><a class="line" href="class_mod_exp_precomputation.html#a4531a88f7159d8399c78a84f3d3caf37"> 29</a></span>  <span class="keyword">virtual</span> <a class="code" href="class_integer.html">Element</a> <a class="code" href="class_mod_exp_precomputation.html#a4531a88f7159d8399c78a84f3d3caf37">ConvertOut</a>(<span class="keyword">const</span> <a class="code" href="class_integer.html">Element</a> &v)<span class="keyword"> const </span>{<span class="keywordflow">return</span> m_mr->ConvertOut(v);}</div><div class="line"><a name="l00030"></a><span class="lineno"><a class="line" href="class_mod_exp_precomputation.html#a2abaa90591d78eba6fbbc121033de7d8"> 30</a></span>  <span class="keyword">const</span> <a class="code" href="class_abstract_group.html">AbstractGroup<Element></a> & <a class="code" href="class_mod_exp_precomputation.html#a2abaa90591d78eba6fbbc121033de7d8">GetGroup</a>()<span class="keyword"> const </span>{<span class="keywordflow">return</span> m_mr->MultiplicativeGroup();}</div><div class="line"><a name="l00031"></a><span class="lineno"><a class="line" href="class_mod_exp_precomputation.html#adbd591c4266c63d0b6786fbb80be6a64"> 31</a></span>  <a class="code" href="class_integer.html">Element</a> <a class="code" href="class_mod_exp_precomputation.html#adbd591c4266c63d0b6786fbb80be6a64">BERDecodeElement</a>(<a class="code" href="class_buffered_transformation.html">BufferedTransformation</a> &bt)<span class="keyword"> const </span>{<span class="keywordflow">return</span> <a class="code" href="class_integer.html">Integer</a>(bt);}</div><div class="line"><a name="l00032"></a><span class="lineno"><a class="line" href="class_mod_exp_precomputation.html#a04c495df3a4f8e72b26c7c7b6fc712cb"> 32</a></span>  <span class="keywordtype">void</span> <a class="code" href="class_mod_exp_precomputation.html#a04c495df3a4f8e72b26c7c7b6fc712cb">DEREncodeElement</a>(<a class="code" href="class_buffered_transformation.html">BufferedTransformation</a> &bt, <span class="keyword">const</span> <a class="code" href="class_integer.html">Element</a> &v)<span class="keyword"> const </span>{v.<a class="code" href="class_integer.html#a0671bd1dbe49e2eecdaaa65ffcb5b6ec">DEREncode</a>(bt);}</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>  <span class="comment">// non-inherited</span></div><div class="line"><a name="l00035"></a><span class="lineno"> 35</span>  <span class="keywordtype">void</span> SetModulus(<span class="keyword">const</span> <a class="code" href="class_integer.html">Integer</a> &v) {m_mr.reset(<span class="keyword">new</span> <a class="code" href="class_montgomery_representation.html">MontgomeryRepresentation</a>(v));}</div><div class="line"><a name="l00036"></a><span class="lineno"> 36</span>  <span class="keyword">const</span> <a class="code" href="class_integer.html">Integer</a> & GetModulus()<span class="keyword"> const </span>{<span class="keywordflow">return</span> m_mr->GetModulus();}</div><div class="line"><a name="l00037"></a><span class="lineno"> 37</span> </div><div class="line"><a name="l00038"></a><span class="lineno"> 38</span> <span class="keyword">private</span>:</div><div class="line"><a name="l00039"></a><span class="lineno"> 39</span>  <a class="code" href="classvalue__ptr.html">value_ptr<MontgomeryRepresentation></a> m_mr;</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> </div><div class="line"><a name="l00042"></a><span class="lineno"> 42</span> NAMESPACE_END</div><div class="line"><a name="l00043"></a><span class="lineno"> 43</span> </div><div class="line"><a name="l00044"></a><span class="lineno"> 44</span> <span class="preprocessor">#if CRYPTOPP_MSC_VERSION</span></div><div class="line"><a name="l00045"></a><span class="lineno"> 45</span> <span class="preprocessor"># pragma warning(pop)</span></div><div class="line"><a name="l00046"></a><span class="lineno"> 46</span> <span class="preprocessor">#endif</span></div><div class="line"><a name="l00047"></a><span class="lineno"> 47</span> </div><div class="line"><a name="l00048"></a><span class="lineno"> 48</span> <span class="preprocessor">#endif</span></div><div class="ttc" id="class_mod_exp_precomputation_html_a4531a88f7159d8399c78a84f3d3caf37"><div class="ttname"><a href="class_mod_exp_precomputation.html#a4531a88f7159d8399c78a84f3d3caf37">ModExpPrecomputation::ConvertOut</a></div><div class="ttdeci">virtual Element ConvertOut(const Element &v) const</div><div class="ttdoc">Converts an element between representations. </div><div class="ttdef"><b>Definition:</b> <a href="modexppc_8h_source.html#l00029">modexppc.h:29</a></div></div> <div class="ttc" id="class_mod_exp_precomputation_html_a4606d689b130f8fcaf156314e4837e4a"><div class="ttname"><a href="class_mod_exp_precomputation.html#a4606d689b130f8fcaf156314e4837e4a">ModExpPrecomputation::NeedConversions</a></div><div class="ttdeci">bool NeedConversions() const</div><div class="ttdoc">Determines if elements needs conversion. </div><div class="ttdef"><b>Definition:</b> <a href="modexppc_8h_source.html#l00027">modexppc.h:27</a></div></div> <div class="ttc" id="class_d_l___group_precomputation_html"><div class="ttname"><a href="class_d_l___group_precomputation.html">DL_GroupPrecomputation</a></div><div class="ttdoc">DL_GroupPrecomputation interface. </div><div class="ttdef"><b>Definition:</b> <a href="eprecomp_8h_source.html#l00019">eprecomp.h:19</a></div></div> <div class="ttc" id="class_integer_html_a0671bd1dbe49e2eecdaaa65ffcb5b6ec"><div class="ttname"><a href="class_integer.html#a0671bd1dbe49e2eecdaaa65ffcb5b6ec">Integer::DEREncode</a></div><div class="ttdeci">void DEREncode(BufferedTransformation &bt) const</div><div class="ttdoc">Encode in DER format. </div><div class="ttdef"><b>Definition:</b> <a href="integer_8cpp_source.html#l03405">integer.cpp:3405</a></div></div> <div class="ttc" id="pubkey_8h_html"><div class="ttname"><a href="pubkey_8h.html">pubkey.h</a></div><div class="ttdoc">This file contains helper classes/functions for implementing public key algorithms. </div></div> <div class="ttc" id="cryptlib_8h_html"><div class="ttname"><a href="cryptlib_8h.html">cryptlib.h</a></div><div class="ttdoc">Abstract base classes that provide a uniform interface to this library. </div></div> <div class="ttc" id="smartptr_8h_html"><div class="ttname"><a href="smartptr_8h.html">smartptr.h</a></div><div class="ttdoc">Classes for automatic resource management. </div></div> <div class="ttc" id="class_mod_exp_precomputation_html_a5e06496338c37c44bfd31ad96eff5866"><div class="ttname"><a href="class_mod_exp_precomputation.html#a5e06496338c37c44bfd31ad96eff5866">ModExpPrecomputation::ConvertIn</a></div><div class="ttdeci">Element ConvertIn(const Element &v) const</div><div class="ttdoc">Converts an element between representations. </div><div class="ttdef"><b>Definition:</b> <a href="modexppc_8h_source.html#l00028">modexppc.h:28</a></div></div> <div class="ttc" id="algebra_8h_html"><div class="ttname"><a href="algebra_8h.html">algebra.h</a></div><div class="ttdoc">Classes for performing mathematics over different fields. </div></div> <div class="ttc" id="class_buffered_transformation_html"><div class="ttname"><a href="class_buffered_transformation.html">BufferedTransformation</a></div><div class="ttdoc">Interface for buffered transformations. </div><div class="ttdef"><b>Definition:</b> <a href="cryptlib_8h_source.html#l01545">cryptlib.h:1545</a></div></div> <div class="ttc" id="class_mod_exp_precomputation_html_adbd591c4266c63d0b6786fbb80be6a64"><div class="ttname"><a href="class_mod_exp_precomputation.html#adbd591c4266c63d0b6786fbb80be6a64">ModExpPrecomputation::BERDecodeElement</a></div><div class="ttdeci">Element BERDecodeElement(BufferedTransformation &bt) const</div><div class="ttdoc">Decodes element in DER format. </div><div class="ttdef"><b>Definition:</b> <a href="modexppc_8h_source.html#l00031">modexppc.h:31</a></div></div> <div class="ttc" id="class_integer_html"><div class="ttname"><a href="class_integer.html">Integer</a></div><div class="ttdoc">Multiple precision integer with arithmetic operations. </div><div class="ttdef"><b>Definition:</b> <a href="integer_8h_source.html#l00049">integer.h:49</a></div></div> <div class="ttc" id="class_mod_exp_precomputation_html"><div class="ttname"><a href="class_mod_exp_precomputation.html">ModExpPrecomputation</a></div><div class="ttdef"><b>Definition:</b> <a href="modexppc_8h_source.html#l00021">modexppc.h:21</a></div></div> <div class="ttc" id="class_abstract_group_html"><div class="ttname"><a href="class_abstract_group.html">AbstractGroup</a></div><div class="ttdoc">Abstract group. </div><div class="ttdef"><b>Definition:</b> <a href="algebra_8h_source.html#l00026">algebra.h:26</a></div></div> <div class="ttc" id="eprecomp_8h_html"><div class="ttname"><a href="eprecomp_8h.html">eprecomp.h</a></div><div class="ttdoc">Classes for precomputation in a group. </div></div> <div class="ttc" id="class_montgomery_representation_html"><div class="ttname"><a href="class_montgomery_representation.html">MontgomeryRepresentation</a></div><div class="ttdoc">Performs modular arithmetic in Montgomery representation for increased speed. </div><div class="ttdef"><b>Definition:</b> <a href="modarith_8h_source.html#l00274">modarith.h:274</a></div></div> <div class="ttc" id="class_mod_exp_precomputation_html_a04c495df3a4f8e72b26c7c7b6fc712cb"><div class="ttname"><a href="class_mod_exp_precomputation.html#a04c495df3a4f8e72b26c7c7b6fc712cb">ModExpPrecomputation::DEREncodeElement</a></div><div class="ttdeci">void DEREncodeElement(BufferedTransformation &bt, const Element &v) const</div><div class="ttdoc">Encodes element in DER format. </div><div class="ttdef"><b>Definition:</b> <a href="modexppc_8h_source.html#l00032">modexppc.h:32</a></div></div> <div class="ttc" id="classvalue__ptr_html"><div class="ttname"><a href="classvalue__ptr.html">value_ptr< MontgomeryRepresentation ></a></div></div> <div class="ttc" id="integer_8h_html"><div class="ttname"><a href="integer_8h.html">integer.h</a></div><div class="ttdoc">Multiple precision integer with arithmetic operations. </div></div> <div class="ttc" id="modarith_8h_html"><div class="ttname"><a href="modarith_8h.html">modarith.h</a></div><div class="ttdoc">Class file for performing modular arithmetic. </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_mod_exp_precomputation_html_a2abaa90591d78eba6fbbc121033de7d8"><div class="ttname"><a href="class_mod_exp_precomputation.html#a2abaa90591d78eba6fbbc121033de7d8">ModExpPrecomputation::GetGroup</a></div><div class="ttdeci">const AbstractGroup< Element > & GetGroup() const</div><div class="ttdoc">Retrieves AbstractGroup interface. </div><div class="ttdef"><b>Definition:</b> <a href="modexppc_8h_source.html#l00030">modexppc.h:30</a></div></div> <div class="ttc" id="class_d_l___fixed_base_precomputation_impl_html"><div class="ttname"><a href="class_d_l___fixed_base_precomputation_impl.html">DL_FixedBasePrecomputationImpl</a></div><div class="ttdoc">DL_FixedBasePrecomputation adapter class. </div><div class="ttdef"><b>Definition:</b> <a href="eprecomp_8h_source.html#l00126">eprecomp.h:126</a></div></div> </div><!-- fragment --></div><!-- contents --> <!-- start footer part --> <hr class="footer"/><address class="footer"><small> Generated on Sun Sep 16 2018 07:57:57 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>