#pragma once #include #include #include "bigint.h" #include "rng.h" extern std::vector smallprimes; void fillsmallprimes(); //For use in RSA (pass target number of bits of N) std::pair genprimepair(Rng &rng,int nbits); //Finds random in range [low,high]; throws range_error("No primes") if no prime found //Will call fillsmallprimes() if not yet done Bigint randprime(Rng &rng,const Bigint &low,const Bigint &high); //checks Fermat [pseudo- or actual] primality bool strongPseudoPrime2(const Bigint &n); //checks Lucas [pseudo- or actual] primality bool strongLucasPrime(const Bigint &n); //checks primality bool bailliePSW(const Bigint &n);