📄 integer_8h-source.html
字号:
<!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++: integer.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 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 List</span></a></li> <li><a href="globals.html"><span>File Members</span></a></li> </ul></div><h1>integer.h</h1><a href="integer_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef CRYPTOPP_INTEGER_H</span><a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define CRYPTOPP_INTEGER_H</span><a name="l00003"></a>00003 <span class="preprocessor"></span><span class="comment"></span><a name="l00004"></a>00004 <span class="comment">/** \file */</span><a name="l00005"></a>00005 <a name="l00006"></a>00006 <span class="preprocessor">#include "<a class="code" href="cryptlib_8h.html">cryptlib.h</a>"</span><a name="l00007"></a>00007 <span class="preprocessor">#include "secblock.h"</span><a name="l00008"></a>00008 <a name="l00009"></a>00009 <span class="preprocessor">#include <iosfwd></span><a name="l00010"></a>00010 <span class="preprocessor">#include <algorithm></span><a name="l00011"></a>00011 <a name="l00012"></a>00012 NAMESPACE_BEGIN(CryptoPP)<a name="l00013"></a>00013 <a name="l00014"></a><a class="code" href="struct_initialize_integer.html">00014</a> struct <a class="code" href="struct_initialize_integer.html">InitializeInteger</a> <span class="comment">// used to initialize static variables</span><a name="l00015"></a>00015 {<a name="l00016"></a>00016 InitializeInteger();<a name="l00017"></a>00017 };<a name="l00018"></a>00018 <a name="l00019"></a><a class="code" href="integer_8h.html#3a61f9ef97b758de0beb6d61cceaadc6">00019</a> <span class="keyword">typedef</span> <a class="code" href="class_sec_block.html" title="a block of memory allocated using A">SecBlock<word, AllocatorWithCleanup<word, CRYPTOPP_BOOL_X86></a> > <a class="code" href="class_sec_block.html" title="a block of memory allocated using A">IntegerSecBlock</a>;<a name="l00020"></a>00020 <span class="comment"></span><a name="l00021"></a>00021 <span class="comment">//! multiple precision integer and basic arithmetics</span><a name="l00022"></a>00022 <span class="comment"></span><span class="comment">/*! This class can represent positive and negative integers</span><a name="l00023"></a>00023 <span class="comment"> with absolute value less than (256**sizeof(word)) ** (256**sizeof(int)).</span><a name="l00024"></a>00024 <span class="comment"> \nosubgrouping</span><a name="l00025"></a>00025 <span class="comment">*/</span><a name="l00026"></a><a class="code" href="class_integer.html">00026</a> <span class="keyword">class </span>CRYPTOPP_DLL <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> : <span class="keyword">private</span> <a class="code" href="struct_initialize_integer.html">InitializeInteger</a>, <span class="keyword">public</span> <a class="code" href="class_a_s_n1_object.html" title="interface for encoding and decoding ASN1 objects">ASN1Object</a><a name="l00027"></a>00027 {<a name="l00028"></a>00028 <span class="keyword">public</span>:<span class="comment"></span><a name="l00029"></a>00029 <span class="comment"> //! \name ENUMS, EXCEPTIONS, and TYPEDEFS</span><a name="l00030"></a>00030 <span class="comment"></span><span class="comment"> //@{</span><a name="l00031"></a>00031 <span class="comment"></span><span class="comment"> //! division by zero exception</span><a name="l00032"></a><a class="code" href="class_integer_1_1_divide_by_zero.html">00032</a> <span class="comment"></span> <span class="keyword">class </span><a class="code" href="class_integer_1_1_divide_by_zero.html" title="division by zero exception">DivideByZero</a> : <span class="keyword">public</span> <a class="code" href="class_exception.html" title="base class for all exceptions thrown by Crypto++">Exception</a><a name="l00033"></a>00033 {<a name="l00034"></a>00034 <span class="keyword">public</span>:<a name="l00035"></a><a class="code" href="class_integer_1_1_divide_by_zero.html#fa9ee5d252af9dc10490f411dcdf162a">00035</a> <a class="code" href="class_integer_1_1_divide_by_zero.html" title="division by zero exception">DivideByZero</a>() : <a class="code" href="class_exception.html" title="base class for all exceptions thrown by Crypto++">Exception</a>(OTHER_ERROR, <span class="stringliteral">"Integer: division by zero"</span>) {}<a name="l00036"></a>00036 };<a name="l00037"></a>00037 <span class="comment"></span><a name="l00038"></a>00038 <span class="comment"> //!</span><a name="l00039"></a><a class="code" href="class_integer_1_1_random_number_not_found.html">00039</a> <span class="comment"></span> <span class="keyword">class </span><a class="code" href="class_integer_1_1_random_number_not_found.html">RandomNumberNotFound</a> : <span class="keyword">public</span> <a class="code" href="class_exception.html" title="base class for all exceptions thrown by Crypto++">Exception</a><a name="l00040"></a>00040 {<a name="l00041"></a>00041 <span class="keyword">public</span>:<a name="l00042"></a><a class="code" href="class_integer_1_1_random_number_not_found.html#46a65e5629532cbd8430ac0b89f04fb8">00042</a> <a class="code" href="class_integer_1_1_random_number_not_found.html">RandomNumberNotFound</a>() : <a class="code" href="class_exception.html" title="base class for all exceptions thrown by Crypto++">Exception</a>(OTHER_ERROR, <span class="stringliteral">"Integer: no integer satisfies the given parameters"</span>) {}<a name="l00043"></a>00043 };<a name="l00044"></a>00044 <span class="comment"></span><a name="l00045"></a>00045 <span class="comment"> //!</span><a name="l00046"></a><a class="code" href="class_integer.html#e0d4d9975fb6ab7667aab6f7ab8612d2">00046</a> <span class="comment"></span> <span class="keyword">enum</span> <a class="code" href="class_integer.html#e0d4d9975fb6ab7667aab6f7ab8612d2">Sign</a> {POSITIVE=0, NEGATIVE=1};<a name="l00047"></a>00047 <span class="comment"></span><a name="l00048"></a>00048 <span class="comment"> //!</span><a name="l00049"></a><a class="code" href="class_integer.html#a9712040ccab541e30c00e0f3ae39926">00049</a> <span class="comment"></span> <span class="keyword">enum</span> <a class="code" href="class_integer.html#a9712040ccab541e30c00e0f3ae39926">Signedness</a> {<span class="comment"></span><a name="l00050"></a>00050 <span class="comment"> //!</span><a name="l00051"></a><a class="code" href="class_integer.html#a9712040ccab541e30c00e0f3ae39926b4fe86ca57cc3668213b99032ca274df">00051</a> <span class="comment"></span> UNSIGNED,<span class="comment"></span><a name="l00052"></a>00052 <span class="comment"> //!</span><a name="l00053"></a><a class="code" href="class_integer.html#a9712040ccab541e30c00e0f3ae399264a42c6ec9823d7d75dcfd97ef6276ccb">00053</a> <span class="comment"></span> SIGNED};<a name="l00054"></a>00054 <span class="comment"></span><a name="l00055"></a>00055 <span class="comment"> //!</span><a name="l00056"></a><a class="code" href="class_integer.html#9b4088ac01abf76b9ba60060abccb7a3">00056</a> <span class="comment"></span> <span class="keyword">enum</span> <a class="code" href="class_integer.html#9b4088ac01abf76b9ba60060abccb7a3">RandomNumberType</a> {<span class="comment"></span><a name="l00057"></a>00057 <span class="comment"> //!</span>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -