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

📄 integer_8h-source.html

📁 著名的密码库Crypto++的文档 C++语言的杰作。程序员必备。
💻 HTML
📖 第 1 页 / 共 5 页
字号:
<a name="l00058"></a><a class="code" href="class_integer.html#9b4088ac01abf76b9ba60060abccb7a3d9b396a7ba736a4ca02db0125cc8c6a4">00058</a> <span class="comment"></span>                        ANY,<span class="comment"></span><a name="l00059"></a>00059 <span class="comment">                //!</span><a name="l00060"></a><a class="code" href="class_integer.html#9b4088ac01abf76b9ba60060abccb7a3fe686f55e5b6768b20009a12522bd0d9">00060</a> <span class="comment"></span>                        PRIME};<span class="comment"></span><a name="l00061"></a>00061 <span class="comment">        //@}</span><a name="l00062"></a>00062 <span class="comment"></span><span class="comment"></span><a name="l00063"></a>00063 <span class="comment">        //! \name CREATORS</span><a name="l00064"></a>00064 <span class="comment"></span><span class="comment">        //@{</span><a name="l00065"></a>00065 <span class="comment"></span><span class="comment">                //! creates the zero integer</span><a name="l00066"></a>00066 <span class="comment"></span>                <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a>();<a name="l00067"></a>00067 <span class="comment"></span><a name="l00068"></a>00068 <span class="comment">                //! copy constructor</span><a name="l00069"></a>00069 <span class="comment"></span>                <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a>(<span class="keyword">const</span> <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a>&amp; t);<a name="l00070"></a>00070 <span class="comment"></span><a name="l00071"></a>00071 <span class="comment">                //! convert from signed long</span><a name="l00072"></a>00072 <span class="comment"></span>                <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a>(<span class="keywordtype">signed</span> <span class="keywordtype">long</span> value);<a name="l00073"></a>00073 <span class="comment"></span><a name="l00074"></a>00074 <span class="comment">                //! convert from lword</span><a name="l00075"></a>00075 <span class="comment"></span>                <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a>(Sign s, lword value);<a name="l00076"></a>00076 <span class="comment"></span><a name="l00077"></a>00077 <span class="comment">                //! convert from two words</span><a name="l00078"></a>00078 <span class="comment"></span>                <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a>(Sign s, word highWord, word lowWord);<a name="l00079"></a>00079 <span class="comment"></span><a name="l00080"></a>00080 <span class="comment">                //! convert from string</span><a name="l00081"></a>00081 <span class="comment"></span><span class="comment">                /*! str can be in base 2, 8, 10, or 16.  Base is determined by a</span><a name="l00082"></a>00082 <span class="comment">                        case insensitive suffix of 'h', 'o', or 'b'.  No suffix means base 10.</span><a name="l00083"></a>00083 <span class="comment">                */</span><a name="l00084"></a>00084                 <span class="keyword">explicit</span> <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *str);<a name="l00085"></a>00085                 <span class="keyword">explicit</span> <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a>(<span class="keyword">const</span> <span class="keywordtype">wchar_t</span> *str);<a name="l00086"></a>00086 <span class="comment"></span><a name="l00087"></a>00087 <span class="comment">                //! convert from big-endian byte array</span><a name="l00088"></a>00088 <span class="comment"></span>                <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a>(<span class="keyword">const</span> byte *encodedInteger, <span class="keywordtype">size_t</span> byteCount, Signedness s=UNSIGNED);<a name="l00089"></a>00089 <span class="comment"></span><a name="l00090"></a>00090 <span class="comment">                //! convert from big-endian form stored in a BufferedTransformation</span><a name="l00091"></a>00091 <span class="comment"></span>                <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a>(<a class="code" href="class_buffered_transformation.html" title="interface for buffered transformations">BufferedTransformation</a> &amp;bt, <span class="keywordtype">size_t</span> byteCount, Signedness s=UNSIGNED);<a name="l00092"></a>00092 <span class="comment"></span><a name="l00093"></a>00093 <span class="comment">                //! convert from BER encoded byte array stored in a BufferedTransformation object</span><a name="l00094"></a>00094 <span class="comment"></span>                <span class="keyword">explicit</span> <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a>(<a class="code" href="class_buffered_transformation.html" title="interface for buffered transformations">BufferedTransformation</a> &amp;bt);<a name="l00095"></a>00095 <span class="comment"></span><a name="l00096"></a>00096 <span class="comment">                //! create a random integer</span><a name="l00097"></a>00097 <span class="comment"></span><span class="comment">                /*! The random integer created is uniformly distributed over [0, 2**bitcount). */</span><a name="l00098"></a>00098                 <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a>(<a class="code" href="class_random_number_generator.html" title="interface for random number generators">RandomNumberGenerator</a> &amp;rng, <span class="keywordtype">size_t</span> bitcount);<a name="l00099"></a>00099 <span class="comment"></span><a name="l00100"></a>00100 <span class="comment">                //! avoid calling constructors for these frequently used integers</span><a name="l00101"></a>00101 <span class="comment"></span>                <span class="keyword">static</span> <span class="keyword">const</span> <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> &amp; CRYPTOPP_API Zero();<span class="comment"></span><a name="l00102"></a>00102 <span class="comment">                //! avoid calling constructors for these frequently used integers</span><a name="l00103"></a>00103 <span class="comment"></span>                <span class="keyword">static</span> <span class="keyword">const</span> <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> &amp; CRYPTOPP_API One();<span class="comment"></span><a name="l00104"></a>00104 <span class="comment">                //! avoid calling constructors for these frequently used integers</span><a name="l00105"></a>00105 <span class="comment"></span>                <span class="keyword">static</span> <span class="keyword">const</span> <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> &amp; CRYPTOPP_API Two();<a name="l00106"></a>00106 <span class="comment"></span><a name="l00107"></a>00107 <span class="comment">                //! create a random integer of special type</span><a name="l00108"></a>00108 <span class="comment"></span><span class="comment">                /*! Ideally, the random integer created should be uniformly distributed</span><a name="l00109"></a>00109 <span class="comment">                        over {x | min &lt;= x &lt;= max and x is of rnType and x % mod == equiv}.</span><a name="l00110"></a>00110 <span class="comment">                        However the actual distribution may not be uniform because sequential</span><a name="l00111"></a>00111 <span class="comment">                        search is used to find an appropriate number from a random starting</span><a name="l00112"></a>00112 <span class="comment">                        point.</span><a name="l00113"></a>00113 <span class="comment">                        May return (with very small probability) a pseudoprime when a prime</span><a name="l00114"></a>00114 <span class="comment">                        is requested and max &gt; lastSmallPrime*lastSmallPrime (lastSmallPrime</span><a name="l00115"></a>00115 <span class="comment">                        is declared in nbtheory.h).</span><a name="l00116"></a>00116 <span class="comment">                        \throw RandomNumberNotFound if the set is empty.</span><a name="l00117"></a>00117 <span class="comment">                */</span><a name="l00118"></a>00118                 <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a>(<a class="code" href="class_random_number_generator.html" title="interface for random number generators">RandomNumberGenerator</a> &amp;rng, <span class="keyword">const</span> <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> &amp;min, <span class="keyword">const</span> <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> &amp;max, RandomNumberType rnType=ANY, <span class="keyword">const</span> <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> &amp;equiv=Zero(), <span class="keyword">const</span> <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> &amp;mod=One());<a name="l00119"></a>00119 <span class="comment"></span><a name="l00120"></a>00120 <span class="comment">                //! return the integer 2**e</span><a name="l00121"></a>00121 <span class="comment"></span>                <span class="keyword">static</span> <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> CRYPTOPP_API Power2(<span class="keywordtype">size_t</span> e);<span class="comment"></span><a name="l00122"></a>00122 <span class="comment">        //@}</span><a name="l00123"></a>00123 <span class="comment"></span><span class="comment"></span><a name="l00124"></a>00124 <span class="comment">        //! \name ENCODE/DECODE</span><a name="l00125"></a>00125 <span class="comment"></span><span class="comment">        //@{</span><a name="l00126"></a>00126 <span class="comment"></span><span class="comment">                //! minimum number of bytes to encode this integer</span><a name="l00127"></a>00127 <span class="comment"></span><span class="comment">                /*! MinEncodedSize of 0 is 1 */</span><a name="l00128"></a>00128                 <span class="keywordtype">size_t</span> MinEncodedSize(Signedness=UNSIGNED) <span class="keyword">const</span>;<span class="comment"></span><a name="l00129"></a>00129 <span class="comment">                //! encode in big-endian format</span><a name="l00130"></a>00130 <span class="comment"></span><span class="comment">                /*! unsigned means encode absolute value, signed means encode two's complement if negative.</span><a name="l00131"></a>00131 <span class="comment">                        if outputLen &lt; MinEncodedSize, the most significant bytes will be dropped</span><a name="l00132"></a>00132 <span class="comment">                        if outputLen &gt; MinEncodedSize, the most significant bytes will be padded</span><a name="l00133"></a>00133 <span class="comment">                */</span><a name="l00134"></a>00134                 <span class="keywordtype">void</span> Encode(byte *output, <span class="keywordtype">size_t</span> outputLen, Signedness=UNSIGNED) <span class="keyword">const</span>;<span class="comment"></span><a name="l00135"></a>00135 <span class="comment">                //!</span>

⌨️ 快捷键说明

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