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

user_prime.cpp File Reference

(Probabilistic) primality testing functions for MPIs More...

#include <stdexcept>
#include <mpi.h>
#include <prime.h>

Namespaces

namespace  mp
namespace  mp::prime

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.


Detailed Description

(Probabilistic) primality testing functions for MPIs


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


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