diff options
Diffstat (limited to 'primes.h')
-rw-r--r-- | primes.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/primes.h b/primes.h new file mode 100644 index 0000000..61e5fc7 --- /dev/null +++ b/primes.h @@ -0,0 +1,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&); |