libktorrent  2.1.1
Public Member Functions | Static Public Member Functions | List of all members
mse::BigInt Class Reference

#include <bigint.h>

Public Member Functions

 BigInt (const BigInt &bi)
 
 BigInt (const QString &value)
 
 BigInt (Uint32 num_bits=0)
 
BigIntoperator= (const BigInt &bi)
 
Uint32 toBuffer (Uint8 *buf, Uint32 max_size) const
 Export the bigint ot a buffer.
 

Static Public Member Functions

static BigInt fromBuffer (const Uint8 *buf, Uint32 size)
 Make a BigInt out of a buffer.
 
static BigInt powerMod (const BigInt &x, const BigInt &e, const BigInt &d)
 
static BigInt random ()
 Make a random BigInt.
 

Detailed Description

Author
Joris Guisson joris.nosp@m..gui.nosp@m.sson@.nosp@m.gmai.nosp@m.l.com

Class which can hold an arbitrary large integer. This will be a very important part of our MSE implementation.

Definition at line 42 of file bigint.h.

Constructor & Destructor Documentation

◆ BigInt() [1/3]

mse::BigInt::BigInt ( Uint32  num_bits = 0)

Create a big integer, with num_bits bits. All bits will be set to 0.

Parameters
num_bitsThe number of bits

◆ BigInt() [2/3]

mse::BigInt::BigInt ( const QString &  value)

Create a big integer of a string. The string must be a hexadecimal representation of an integer. For example : 12AFFE123488BBBE123

Letters can be upper or lower case. Invalid chars will create an invalid number.

Parameters
valueThe hexadecimal representation of the number

◆ BigInt() [3/3]

mse::BigInt::BigInt ( const BigInt bi)

Copy constructor.

Parameters
biBigInt to copy

Member Function Documentation

◆ operator=()

BigInt& mse::BigInt::operator= ( const BigInt bi)

Assignment operator.

Parameters
biThe BigInt to copy
Returns
*this

◆ powerMod()

static BigInt mse::BigInt::powerMod ( const BigInt x,
const BigInt e,
const BigInt d 
)
static

Calculates (x ^ e) mod d ^ is power


The documentation for this class was generated from the following file: