aboutsummaryrefslogtreecommitdiff
path: root/primes.h
blob: 61e5fc7a4ec9ec75120f6e0fee49612a98361926 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#pragma once

#include <vector>
#include <utility>
#include "bigint.h"

extern std::vector<int> smallprimes;

void fillsmallprimes();

//for use in RSA (pass target number of bits of N)
std::pair<Bigint,Bigint> genprimepair(int nbits);

//finds random in range [low,high]; throws domain_error if no prime found
//Will call fillsmallprimes() if not yet done
Bigint randprime(const Bigint &low,const Bigint &high);

//checks primality
bool bailliePSW(const Bigint&);