Main Page | Modules | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

mp::prime Namespace Reference

Container for primality testing stuff. More...


Functions

bool pt_small (const mpi &x)
 Test number against small primes (8 or 12 bit).
bool rabin_miller (const mpi &p, const mpi &m, const limb_type b)
 Actual Rabin-Miller primality test.
bool pt_prob (const mpi &x, int n)
 Run through a few probabilistic tests.

Variables

const int PRIMEN = 564
 Number of 12-bit primes.
const limb_type PRIME [PRIMEN]
 List of all 12-bit primes.


Detailed Description

Container for primality testing stuff.

Function Documentation

bool pt_prob const mpi &  x,
int  n
 

Run through a few probabilistic tests.

This sets up the precomputation for the Rabin-Miller probabilistic primality test.

Parameters:
x Number to test
n Number of trials for primality
Returns:
True if the number passes all tests

bool pt_small const mpi &  x  ) 
 

Test number against small primes (8 or 12 bit).

Parameters:
x Number to test
Returns:
True if the number doesn't factor to any of the small primes

bool rabin_miller const mpi &  p,
const mpi &  m,
const limb_type  b
 

Actual Rabin-Miller primality test.

This is described in detail on page 260 of _Handbook of Applied Cryptography Second Edition_ by Bruce Schneier.

Parameters:
p Number to test
m First precomputed value
b Second precomputed value
Returns:
True if the number passes the test


Variable Documentation

const limb_type mp::prime::PRIME[PRIMEN]
 

List of all 12-bit primes.

const int mp::prime::PRIMEN = 564
 

Number of 12-bit primes.


Generated on Fri Feb 4 16:17:55 2005 for LibMP++ by  doxygen 1.4.1