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

📄 polynomi_8h-source.html

📁 Crypto++是一个非常强大的密码学库,主要是功能全
💻 HTML
📖 第 1 页 / 共 5 页
字号:
00180 <span class="comment">                //! construct constant polynomial</span><a name="l00181"></a><a class="code" href="class_polynomial_over_fixed_ring.html#_polynomial_over_fixed_ringz67_3">00181</a> <span class="comment"></span>                <a class="code" href="class_polynomial_over_fixed_ring.html#_polynomial_over_fixed_ringz67_0">PolynomialOverFixedRing</a>(<span class="keyword">const</span> CoefficientType &amp;element) : <a class="code" href="class_polynomial_over.html">B</a>(element) {}00182 <span class="comment"></span>00183 <span class="comment">                //! construct polynomial with specified coefficients, starting from coefficient of x^0</span><a name="l00184"></a><a class="code" href="class_polynomial_over_fixed_ring.html#_polynomial_over_fixed_ringz67_4">00184</a> <span class="comment"></span>                <span class="keyword">template</span> &lt;<span class="keyword">typename</span> Iterator&gt; <a class="code" href="class_polynomial_over_fixed_ring.html#_polynomial_over_fixed_ringz67_0">PolynomialOverFixedRing</a>(Iterator first, Iterator last)00185                         : <a class="code" href="class_polynomial_over.html">B</a>(first, last) {}00186 <span class="comment"></span>00187 <span class="comment">                //! convert from string</span><a name="l00188"></a><a class="code" href="class_polynomial_over_fixed_ring.html#_polynomial_over_fixed_ringz67_5">00188</a> <span class="comment"></span>                <span class="keyword">explicit</span> <a class="code" href="class_polynomial_over_fixed_ring.html#_polynomial_over_fixed_ringz67_0">PolynomialOverFixedRing</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *str) : <a class="code" href="class_polynomial_over.html">B</a>(str, fixedRing) {}00189 <span class="comment"></span>00190 <span class="comment">                //! convert from big-endian byte array</span><a name="l00191"></a><a class="code" href="class_polynomial_over_fixed_ring.html#_polynomial_over_fixed_ringz67_6">00191</a> <span class="comment"></span>                <a class="code" href="class_polynomial_over_fixed_ring.html#_polynomial_over_fixed_ringz67_0">PolynomialOverFixedRing</a>(<span class="keyword">const</span> byte *encodedPoly, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> byteCount) : <a class="code" href="class_polynomial_over.html">B</a>(encodedPoly, byteCount) {}00192 <span class="comment"></span>00193 <span class="comment">                //! convert from Basic Encoding Rules encoded byte array</span><a name="l00194"></a><a class="code" href="class_polynomial_over_fixed_ring.html#_polynomial_over_fixed_ringz67_7">00194</a> <span class="comment"></span>                <span class="keyword">explicit</span> <a class="code" href="class_polynomial_over_fixed_ring.html#_polynomial_over_fixed_ringz67_0">PolynomialOverFixedRing</a>(<span class="keyword">const</span> byte *BEREncodedPoly) : <a class="code" href="class_polynomial_over.html">B</a>(BEREncodedPoly) {}00195 <span class="comment"></span>00196 <span class="comment">                //! convert from BER encoded byte array stored in a BufferedTransformation object</span><a name="l00197"></a><a class="code" href="class_polynomial_over_fixed_ring.html#_polynomial_over_fixed_ringz67_8">00197</a> <span class="comment"></span>                <span class="keyword">explicit</span> <a class="code" href="class_polynomial_over_fixed_ring.html#_polynomial_over_fixed_ringz67_0">PolynomialOverFixedRing</a>(<a class="code" href="class_buffered_transformation.html">BufferedTransformation</a> &amp;bt) : <a class="code" href="class_polynomial_over.html">B</a>(bt) {}00198 <span class="comment"></span>00199 <span class="comment">                //! create a random PolynomialOverFixedRing</span><a name="l00200"></a><a class="code" href="class_polynomial_over_fixed_ring.html#_polynomial_over_fixed_ringz67_9">00200</a> <span class="comment"></span>                <a class="code" href="class_polynomial_over_fixed_ring.html#_polynomial_over_fixed_ringz67_0">PolynomialOverFixedRing</a>(<a class="code" href="class_random_number_generator.html">RandomNumberGenerator</a> &amp;rng, <span class="keyword">const</span> RandomizationParameter &amp;parameter) : <a class="code" href="class_polynomial_over.html">B</a>(rng, parameter, fixedRing) {}00201 00202                 <span class="keyword">static</span> <span class="keyword">const</span> ThisType &amp;Zero();00203                 <span class="keyword">static</span> <span class="keyword">const</span> ThisType &amp;One();<span class="comment"></span>00204 <span class="comment">        //@}</span>00205 <span class="comment"></span><span class="comment"></span>00206 <span class="comment">        //! \name ACCESSORS</span>00207 <span class="comment"></span><span class="comment">        //@{</span>00208 <span class="comment"></span><span class="comment">                //! the zero polynomial will return a degree of -1</span><a name="l00209"></a><a class="code" href="class_polynomial_over_fixed_ring.html#_polynomial_over_fixed_ringz69_0">00209</a> <span class="comment"></span>                <span class="keywordtype">int</span> <a class="code" href="class_polynomial_over_fixed_ring.html#_polynomial_over_fixed_ringz69_0">Degree</a>()<span class="keyword"> const </span>{<span class="keywordflow">return</span> B::Degree(fixedRing);}<span class="comment"></span>00210 <span class="comment">                //! degree + 1</span><a name="l00211"></a><a class="code" href="class_polynomial_over_fixed_ring.html#_polynomial_over_fixed_ringz69_1">00211</a> <span class="comment"></span>                <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="class_polynomial_over_fixed_ring.html#_polynomial_over_fixed_ringz69_1">CoefficientCount</a>()<span class="keyword"> const </span>{<span class="keywordflow">return</span> B::CoefficientCount(fixedRing);}<span class="comment"></span>00212 <span class="comment">                //! return coefficient for x^i</span><a name="l00213"></a><a class="code" href="class_polynomial_over_fixed_ring.html#_polynomial_over_fixed_ringz69_2">00213</a> <span class="comment"></span>                CoefficientType <a class="code" href="class_polynomial_over_fixed_ring.html#_polynomial_over_fixed_ringz69_2">GetCoefficient</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i)<span class="keyword"> const </span>{<span class="keywordflow">return</span> B::GetCoefficient(i, fixedRing);}<span class="comment"></span>00214 <span class="comment">                //! return coefficient for x^i</span><a name="l00215"></a><a class="code" href="class_polynomial_over_fixed_ring.html#_polynomial_over_fixed_ringz69_3">00215</a> <span class="comment"></span>                CoefficientType <a class="code" href="class_polynomial_over_fixed_ring.html#_polynomial_over_fixed_ringz69_3">operator[]</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i)<span class="keyword"> const </span>{<span class="keywordflow">return</span> B::GetCoefficient(i, fixedRing);}<span class="comment"></span>00216 <span class="comment">        //@}</span>00217 <span class="comment"></span><span class="comment"></span>00218 <span class="comment">        //! \name MANIPULATORS</span>00219 <span class="comment"></span><span class="comment">        //@{</span>00220 <span class="comment"></span><span class="comment">                //!</span>00221 <span class="comment"></span>                ThisType&amp;  operator=(<span class="keyword">const</span> ThisType&amp; t) {B::operator=(t); <span class="keywordflow">return</span> *<span class="keyword">this</span>;}<span class="comment"></span>00222 <span class="comment">                //!</span>00223 <span class="comment"></span>                ThisType&amp;  operator+=(<span class="keyword">const</span> ThisType&amp; t) {Accumulate(t, fixedRing); <span class="keywordflow">return</span> *<span class="keyword">this</span>;}<span class="comment"></span>00224 <span class="comment">                //!</span>00225 <span class="comment"></span>                ThisType&amp;  operator-=(<span class="keyword">const</span> ThisType&amp; t) {Reduce(t, fixedRing); <span class="keywordflow">return</span> *<span class="keyword">this</span>;}<span class="comment"></span>00226 <span class="comment">                //!</span>00227 <span class="comment"></span>                ThisType&amp;  operator*=(<span class="keyword">const</span> ThisType&amp; t) {<span class="keywordflow">return</span> *<span class="keyword">this</span> = *<span class="keyword">this</span>*t;}<span class="comment"></span>00228 <span class="comment">                //!</span>00229 <span class="comment"></span>                ThisType&amp;  operator/=(<span class="keyword">const</span> ThisType&amp; t) {<span class="keywordflow">return</span> *<span class="keyword">this</span> = *<span class="keyword">this</span>/t;}<span class="comment"></span>00230 <span class="comment">                //!</span>00231 <span class="comment"></span>                ThisType&amp;  operator%=(<span class="keyword">const</span> ThisType&amp; t) {<span class="keywordflow">return</span> *<span class="keyword">this</span> = *<span class="keyword">this</span>%t;}00232 <span class="comment"></span>00233 <span class="comment">                //!</span>00234 <span class="comment"></span>                ThisType&amp;  operator&lt;&lt;=(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> n) {ShiftLeft(n, fixedRing); <span class="keywordflow">return</span> *<span class="keyword">this</span>;}<span class="comment"></span>00235 <span class="comment">                //!</span>00236 <span class="comment"></span>                ThisType&amp;  operator&gt;&gt;=(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> n) {ShiftRight(n, fixedRing); <span class="keywordflow">return</span> *<span class="keyword">this</span>;}00237 <span class="comment"></span>00238 <span class="comment">                //! set the coefficient for x^i to value</span><a name="l00239"></a><a class="code" href="class_polynomial_over_fixed_ring.html#_polynomial_over_fixed_ringz71_8">00239</a> <span class="comment"></span>                <span class="keywordtype">void</span> <a class="code" href="class_polynomial_over_fixed_ring.html#_polynomial_over_fixed_ringz71_8">SetCoefficient</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i, <span class="keyword">const</span> CoefficientType &amp;value) {B::SetCoefficient(i, value, fixedRing);}00240 <span class="comment"></span>00241 <span class="comment">                //!</span>00242 <span class="comment"></span>                <span class="keywordtype">void</span> Randomize(<a class="code" href="class_random_number_generator.html">RandomNumberGenerator</a> &amp;rng, <span class="keyword">const</span> RandomizationParameter &amp;parameter) {B::Randomize(rng, parameter, fixedRing);}00243 <span class="comment"></span>00244 <span class="comment">                //!</span>00245 <span class="comment"></span>                <span class="keywordtype">void</span> Negate() {B::Negate(fixedRing);}00246 00247                 <span class="keywordtype">void</span> swap(ThisType &amp;t) {B::swap(t);}<span class="comment"></span>00248 <span class="comment">        //@}</span>00249 <span class="comment"></span><span class="comment"></span>00250 <span class="comment">        //! \name UNARY OPERATORS</span>00251 <span class="comment"></span><span class="comment">        //@{</span>00252 <span class="comment"></span><span class="comment">                //!</span>00253 <span class="comment"></span>                <span class="keywordtype">bool</span> operator!()<span class="keyword"> const </span>{<span class="keywordflow">return</span> <a class="code" href="class_polynomial_over_fixed_ring.html#_polynomial_over_fixed_ringz69_1">CoefficientCount</a>()==0;}<span class="comment"></span>00254 <span class="comment">                //!</span>00255 <span class="comment"></span>                ThisType operator+()<span class="keyword"> const </span>{<span class="keywordflow">return</span> *<span class="keyword">this</span>;}<span class="comment"></span>00256 <span class="comment">                //!</span>00257 <span class="comment"></span>                ThisType operator-()<span class="keyword"> const </span>{<span class="keywordflow">return</span> ThisType(Inverse(fixedRing));}<span class="comment"></span>00258 <span class="comment">        //@}</span>00259 <span class="comment"></span><span class="comment"></span>00260 <span class="comment">        //! \name BINARY OPERATORS</span>00261 <span class="comment"></span><span class="comment">        //@{</span>00262 <span class="comment"></span><span class="comment">                //!</span>00263 <span class="comment"></span>                <span class="keyword">friend</span> ThisType operator&gt;&gt;(ThisType a, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> n)  {<span class="keywordflow">return</span> ThisType(a&gt;&gt;=n);}<span class="comment"></span>00264 <span class="comment">                //!</span>00265 <span class="comment"></span>                <span class="keyword">friend</span> ThisType operator&lt;&lt;(ThisType a, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> n)  {<span class="keywordflow">return</span> ThisType(a&lt;&lt;=n);}<span class="comment"></span>00266 <span class="comment">        //@}</span>00267 <span class="comment"></span><span class="comment"></span>00268 <span class="comment">        //! \name OTHER ARITHMETIC FUNCTIONS</span>00269 <span class="comment"></span><span class="comment">        //@{</span>00270 <span class="comment"></span><span class="comment">                //!</span>00271 <span class="comment"></span>                ThisType MultiplicativeInverse()<span class="keyword"> const </span>{<span class="keywordflow">return</span> ThisType(B::MultiplicativeInverse(fixedRing));}<span class="comment"></span>00272 <span class="comment">                //!</span>

⌨️ 快捷键说明

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