Fabcoin Core  0.16.2
P2P Digital Currency
Classes | Typedefs | Functions
integer.h File Reference

Multiple precision integer with arithmetic operations. More...

#include "cryptlib.h"
#include "secblock.h"
#include "stdcpp.h"
#include <iosfwd>
Include dependency graph for integer.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  InitializeInteger
 Performs static initialization of the Integer class. More...
 
class  Integer
 Multiple precision integer with arithmetic operations. More...
 
class  Integer::DivideByZero
 Exception thrown when division by 0 is encountered. More...
 
class  Integer::RandomNumberNotFound
 Exception thrown when a random number cannot be found that satisfies the condition. More...
 
class  Integer::OpenPGPDecodeErr
 Exception thrown when an error is encountered decoding an OpenPGP integer. More...
 

Typedefs

typedef SecBlock< word, AllocatorWithCleanup< word, true > > IntegerSecBlock
 

Functions

bool operator== (const CryptoPP::Integer &a, const CryptoPP::Integer &b)
 Comparison. More...
 
bool operator!= (const CryptoPP::Integer &a, const CryptoPP::Integer &b)
 Comparison. More...
 
bool operator> (const CryptoPP::Integer &a, const CryptoPP::Integer &b)
 Comparison. More...
 
bool operator>= (const CryptoPP::Integer &a, const CryptoPP::Integer &b)
 Comparison. More...
 
bool operator< (const CryptoPP::Integer &a, const CryptoPP::Integer &b)
 Comparison. More...
 
bool operator<= (const CryptoPP::Integer &a, const CryptoPP::Integer &b)
 Comparison. More...
 
CryptoPP::Integer operator+ (const CryptoPP::Integer &a, const CryptoPP::Integer &b)
 Addition. More...
 
CryptoPP::Integer operator- (const CryptoPP::Integer &a, const CryptoPP::Integer &b)
 Subtraction. More...
 
CryptoPP::Integer operator* (const CryptoPP::Integer &a, const CryptoPP::Integer &b)
 Multiplication. More...
 
CryptoPP::Integer operator/ (const CryptoPP::Integer &a, const CryptoPP::Integer &b)
 Division. More...
 
CryptoPP::Integer operator% (const CryptoPP::Integer &a, const CryptoPP::Integer &b)
 Remainder. More...
 
CryptoPP::Integer operator/ (const CryptoPP::Integer &a, CryptoPP::word b)
 Division. More...
 
CryptoPP::word operator% (const CryptoPP::Integer &a, CryptoPP::word b)
 Remainder. More...
 
CryptoPP::Integer operator& (const CryptoPP::Integer &a, const CryptoPP::Integer &b)
 Bitwise AND. More...
 
CryptoPP::Integer operator| (const CryptoPP::Integer &a, const CryptoPP::Integer &b)
 Bitwise OR. More...
 
CryptoPP::Integer operator^ (const CryptoPP::Integer &a, const CryptoPP::Integer &b)
 Bitwise XOR. More...
 
NAMESPACE_END void swap (CryptoPP::Integer &a, CryptoPP::Integer &b)
 

Detailed Description

Multiple precision integer with arithmetic operations.

The Integer class can represent positive and negative integers with absolute value less than (256**sizeof(word))(256**sizeof(int)).

Internally, the library uses a sign magnitude representation, and the class has two data members. The first is a IntegerSecBlock (a SecBlock<word>) and it is used to hold the representation. The second is a Sign (an enumeration), and it is used to track the sign of the Integer.

Since
Crypto++ 1.0

Definition in file integer.h.

Typedef Documentation

Definition at line 32 of file integer.h.

Function Documentation

bool operator!= ( const CryptoPP::Integer &  a,
const CryptoPP::Integer &  b 
)
inline

Comparison.

Definition at line 650 of file integer.h.

CryptoPP::Integer operator% ( const CryptoPP::Integer &  a,
const CryptoPP::Integer &  b 
)
inline

Remainder.

See also
a_times_b_mod_c() and a_exp_b_mod_c()

Definition at line 670 of file integer.h.

CryptoPP::word operator% ( const CryptoPP::Integer &  a,
CryptoPP::word  b 
)
inline

Remainder.

See also
a_times_b_mod_c() and a_exp_b_mod_c()

Definition at line 675 of file integer.h.

CryptoPP::Integer operator& ( const CryptoPP::Integer &  a,
const CryptoPP::Integer &  b 
)
inline

Bitwise AND.

Parameters
athe first Integer
bthe second Integer
Returns
the result of a & b

operator&() performs a bitwise AND on the operands. Missing bits are truncated at the most significant bit positions, so the result is as small as the smaller of the operands.

Internally, Crypto++ uses a sign-magnitude representation. The library does not attempt to interpret bits, and the result is always POSITIVE. If needed, the integer should be converted to a 2's compliment representation before performing the operation.

Since
Crypto++ 5.7

Definition at line 689 of file integer.h.

CryptoPP::Integer operator* ( const CryptoPP::Integer &  a,
const CryptoPP::Integer &  b 
)
inline

Multiplication.

See also
a_times_b_mod_c() and a_exp_b_mod_c()

Definition at line 665 of file integer.h.

CryptoPP::Integer operator+ ( const CryptoPP::Integer &  a,
const CryptoPP::Integer &  b 
)
inline

Addition.

Definition at line 660 of file integer.h.

CryptoPP::Integer operator- ( const CryptoPP::Integer &  a,
const CryptoPP::Integer &  b 
)
inline

Subtraction.

Definition at line 662 of file integer.h.

Here is the caller graph for this function:

CryptoPP::Integer operator/ ( const CryptoPP::Integer &  a,
const CryptoPP::Integer &  b 
)
inline

Division.

Definition at line 667 of file integer.h.

CryptoPP::Integer operator/ ( const CryptoPP::Integer &  a,
CryptoPP::word  b 
)
inline

Division.

Definition at line 672 of file integer.h.

bool operator< ( const CryptoPP::Integer &  a,
const CryptoPP::Integer &  b 
)
inline

Comparison.

Definition at line 656 of file integer.h.

bool operator<= ( const CryptoPP::Integer &  a,
const CryptoPP::Integer &  b 
)
inline

Comparison.

Definition at line 658 of file integer.h.

bool operator== ( const CryptoPP::Integer &  a,
const CryptoPP::Integer &  b 
)
inline

Comparison.

Definition at line 648 of file integer.h.

bool operator> ( const CryptoPP::Integer &  a,
const CryptoPP::Integer &  b 
)
inline

Comparison.

Definition at line 652 of file integer.h.

bool operator>= ( const CryptoPP::Integer &  a,
const CryptoPP::Integer &  b 
)
inline

Comparison.

Definition at line 654 of file integer.h.

CryptoPP::Integer operator^ ( const CryptoPP::Integer &  a,
const CryptoPP::Integer &  b 
)
inline

Bitwise XOR.

Parameters
athe first Integer
bthe second Integer
Returns
the result of a ^ b

operator^() performs a bitwise XOR on the operands. Missing bits are shifted in at the most significant bit positions, so the result is as large as the larger of the operands.

Internally, Crypto++ uses a sign-magnitude representation. The library does not attempt to interpret bits, and the result is always POSITIVE. If needed, the integer should be converted to a 2's compliment representation before performing the operation.

Since
Crypto++ 5.7

Definition at line 717 of file integer.h.

CryptoPP::Integer operator| ( const CryptoPP::Integer &  a,
const CryptoPP::Integer &  b 
)
inline

Bitwise OR.

Parameters
athe first Integer
bthe second Integer
Returns
the result of a | b

operator|() performs a bitwise OR on the operands. Missing bits are shifted in at the most significant bit positions, so the result is as large as the larger of the operands.

Internally, Crypto++ uses a sign-magnitude representation. The library does not attempt to interpret bits, and the result is always POSITIVE. If needed, the integer should be converted to a 2's compliment representation before performing the operation.

Since
Crypto++ 5.7

Definition at line 703 of file integer.h.

NAMESPACE_END void swap ( CryptoPP::Integer &  a,
CryptoPP::Integer &  b 
)
inline

Definition at line 723 of file integer.h.

Here is the caller graph for this function: