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

📄 ec2n_8h-source.html

📁 著名的密码库Crypto++的文档 C++语言的杰作。程序员必备。
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<!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++: ec2n.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&nbsp;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&nbsp;List</span></a></li>    <li><a href="globals.html"><span>File&nbsp;Members</span></a></li>  </ul></div><h1>ec2n.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef CRYPTOPP_EC2N_H</span><a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define CRYPTOPP_EC2N_H</span><a name="l00003"></a>00003 <span class="preprocessor"></span><a name="l00004"></a>00004 <span class="preprocessor">#include "<a class="code" href="gf2n_8h.html">gf2n.h</a>"</span><a name="l00005"></a>00005 <span class="preprocessor">#include "eprecomp.h"</span><a name="l00006"></a>00006 <span class="preprocessor">#include "smartptr.h"</span><a name="l00007"></a>00007 <span class="preprocessor">#include "<a class="code" href="pubkey_8h.html" title="This file contains helper classes/functions for implementing public key algorithms...">pubkey.h</a>"</span><a name="l00008"></a>00008 <a name="l00009"></a>00009 NAMESPACE_BEGIN(CryptoPP)<a name="l00010"></a>00010 <a name="l00011"></a>00011 <span class="comment">//! Elliptic Curve Point</span><a name="l00012"></a><a class="code" href="struct_e_c2_n_point.html">00012</a> <span class="comment"></span>struct CRYPTOPP_DLL <a class="code" href="struct_e_c2_n_point.html" title="Elliptic Curve Point.">EC2NPoint</a><a name="l00013"></a>00013 {<a name="l00014"></a><a class="code" href="struct_e_c2_n_point.html#44b8d1ff66cc2b6a05c72d5d2669b65b">00014</a>         EC2NPoint() : identity(true) {}<a name="l00015"></a><a class="code" href="struct_e_c2_n_point.html#7ea8ec548d653530054aeb9c4c54e24d">00015</a>         EC2NPoint(<span class="keyword">const</span> <a class="code" href="class_polynomial_mod2.html" title="Polynomial with Coefficients in GF(2).">PolynomialMod2</a> &amp;x, <span class="keyword">const</span> <a class="code" href="class_polynomial_mod2.html" title="Polynomial with Coefficients in GF(2).">PolynomialMod2</a> &amp;y)<a name="l00016"></a>00016                 : identity(false), x(x), y(y) {}<a name="l00017"></a>00017 <a name="l00018"></a><a class="code" href="struct_e_c2_n_point.html#0559dcd6748b0b1ab727d59a59b51dbf">00018</a>         <span class="keywordtype">bool</span> <a class="code" href="gf2n_8h.html#22c25c181c409600aa2e4bf1067ac47a">operator==</a>(<span class="keyword">const</span> EC2NPoint &amp;t)<span class="keyword"> const</span><a name="l00019"></a>00019 <span class="keyword">                </span>{<span class="keywordflow">return</span> (identity &amp;&amp; t.<a class="code" href="struct_e_c2_n_point.html#6ded60d603c7ba5af13c7ba3da253cf7">identity</a>) || (!identity &amp;&amp; !t.<a class="code" href="struct_e_c2_n_point.html#6ded60d603c7ba5af13c7ba3da253cf7">identity</a> &amp;&amp; x==t.<a class="code" href="struct_e_c2_n_point.html#b90a3edb6b82f616b6a281315289c574">x</a> &amp;&amp; y==t.<a class="code" href="struct_e_c2_n_point.html#0ef74f2187b87841db0c36fef978f387">y</a>);}<a name="l00020"></a><a class="code" href="struct_e_c2_n_point.html#f6b871137539ef366167997d0aa2da90">00020</a>         <span class="keywordtype">bool</span> <a class="code" href="gf2n_8h.html#f81f67e93bfb8bbb776cab689c83c7e9" title="compares degree">operator&lt; </a>(<span class="keyword">const</span> EC2NPoint &amp;t)<span class="keyword"> const</span><a name="l00021"></a>00021 <span class="keyword">                </span>{<span class="keywordflow">return</span> identity ? !t.<a class="code" href="struct_e_c2_n_point.html#6ded60d603c7ba5af13c7ba3da253cf7">identity</a> : (!t.<a class="code" href="struct_e_c2_n_point.html#6ded60d603c7ba5af13c7ba3da253cf7">identity</a> &amp;&amp; (x&lt;t.<a class="code" href="struct_e_c2_n_point.html#b90a3edb6b82f616b6a281315289c574">x</a> || (x==t.<a class="code" href="struct_e_c2_n_point.html#b90a3edb6b82f616b6a281315289c574">x</a> &amp;&amp; y&lt;t.<a class="code" href="struct_e_c2_n_point.html#0ef74f2187b87841db0c36fef978f387">y</a>)));}<a name="l00022"></a>00022 <a name="l00023"></a><a class="code" href="struct_e_c2_n_point.html#6ded60d603c7ba5af13c7ba3da253cf7">00023</a>         <span class="keywordtype">bool</span> identity;<a name="l00024"></a><a class="code" href="struct_e_c2_n_point.html#0ef74f2187b87841db0c36fef978f387">00024</a>         <a class="code" href="class_polynomial_mod2.html" title="Polynomial with Coefficients in GF(2).">PolynomialMod2</a> x, y;<a name="l00025"></a>00025 };<a name="l00026"></a>00026 <a name="l00027"></a>00027 CRYPTOPP_DLL_TEMPLATE_CLASS <a class="code" href="class_abstract_group.html" title="Abstract Group.">AbstractGroup&lt;EC2NPoint&gt;</a>;<a name="l00028"></a>00028 <span class="comment"></span><a name="l00029"></a>00029 <span class="comment">//! Elliptic Curve over GF(2^n)</span><a name="l00030"></a><a class="code" href="class_e_c2_n.html">00030</a> <span class="comment"></span><span class="keyword">class </span>CRYPTOPP_DLL <a class="code" href="class_e_c2_n.html" title="Elliptic Curve over GF(2^n).">EC2N</a> : <span class="keyword">public</span> <a class="code" href="class_abstract_group.html" title="Abstract Group.">AbstractGroup</a>&lt;EC2NPoint&gt;<a name="l00031"></a>00031 {<a name="l00032"></a>00032 <span class="keyword">public</span>:<a name="l00033"></a><a class="code" href="class_e_c2_n.html#7088a58b07065cbfd20ee5df924ed99e">00033</a>         <span class="keyword">typedef</span> <a class="code" href="class_g_f2_n_p.html" title="GF(2^n) with Polynomial Basis.">GF2NP</a> <a class="code" href="class_g_f2_n_p.html" title="GF(2^n) with Polynomial Basis.">Field</a>;<a name="l00034"></a><a class="code" href="class_e_c2_n.html#e03206f65d1a99b107de72c7d86704c2">00034</a>         <span class="keyword">typedef</span> Field::Element FieldElement;<a name="l00035"></a><a class="code" href="class_e_c2_n.html#084d1d7e824e989357c2ac9bf8b077c1">00035</a>         <span class="keyword">typedef</span> <a class="code" href="struct_e_c2_n_point.html" title="Elliptic Curve Point.">EC2NPoint</a> <a class="code" href="struct_e_c2_n_point.html" title="Elliptic Curve Point.">Point</a>;<a name="l00036"></a>00036 <a name="l00037"></a><a class="code" href="class_e_c2_n.html#cbb968e8d6cf037bd654de5ceba89e4c">00037</a>         <a class="code" href="class_e_c2_n.html" title="Elliptic Curve over GF(2^n).">EC2N</a>() {}<a name="l00038"></a><a class="code" href="class_e_c2_n.html#8f8084f4fa2f0658417b64b55b08543f">00038</a>         <a class="code" href="class_e_c2_n.html" title="Elliptic Curve over GF(2^n).">EC2N</a>(<span class="keyword">const</span> <a class="code" href="class_g_f2_n_p.html" title="GF(2^n) with Polynomial Basis.">Field</a> &amp;field, <span class="keyword">const</span> Field::Element &amp;a, <span class="keyword">const</span> Field::Element &amp;b)<a name="l00039"></a>00039                 : m_field(field), m_a(a), m_b(b) {}<a name="l00040"></a>00040         <span class="comment">// construct from BER encoded parameters</span><a name="l00041"></a>00041         <span class="comment">// this constructor will decode and extract the the fields fieldID and curve of the sequence ECParameters</span><a name="l00042"></a>00042         <a class="code" href="class_e_c2_n.html" title="Elliptic Curve over GF(2^n).">EC2N</a>(<a class="code" href="class_buffered_transformation.html" title="interface for buffered transformations">BufferedTransformation</a> &amp;bt);<a name="l00043"></a>00043 <a name="l00044"></a>00044         <span class="comment">// encode the fields fieldID and curve of the sequence ECParameters</span><a name="l00045"></a>00045         <span class="keywordtype">void</span> DEREncode(<a class="code" href="class_buffered_transformation.html" title="interface for buffered transformations">BufferedTransformation</a> &amp;bt) <span class="keyword">const</span>;<a name="l00046"></a>00046 <a name="l00047"></a>00047         <span class="keywordtype">bool</span> Equal(<span class="keyword">const</span> Point &amp;P, <span class="keyword">const</span> Point &amp;Q) <span class="keyword">const</span>;<a name="l00048"></a>00048         <span class="keyword">const</span> Point&amp; Identity() <span class="keyword">const</span>;<a name="l00049"></a>00049         <span class="keyword">const</span> Point&amp; Inverse(<span class="keyword">const</span> Point &amp;P) <span class="keyword">const</span>;

⌨️ 快捷键说明

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