8#include <botan/pow_mod.h>
9#include <botan/libstate.h>
10#include <botan/engine.h>
32 core = other.core->
copy();
43 core = other.core->
copy();
69 core = engine->mod_exp(n, hints);
76 throw Lookup_Error(
"Power_Mod: Unable to find a working engine");
103 core->set_exponent(e);
113 return core->execute();
122 static const size_t wsize[][2] = {
135 for(
size_t j = 0; wsize[j][0]; ++j)
137 if(exp_bits >= wsize[j][0])
164 const size_t b_bits = b.
bits();
165 const size_t n_bits = n.
bits();
167 if(b_bits < n_bits / 32)
169 if(b_bits > n_bits / 4)
180 const size_t e_bits = e.bits();
181 const size_t n_bits = n.bits();
183 if(e_bits < n_bits / 32)
185 if(e_bits > n_bits / 4)
Fixed_Exponent_Power_Mod()
virtual Modular_Exponentiator * copy() const =0
void set_exponent(const BigInt &) const
void set_base(const BigInt &) const
void set_modulus(const BigInt &, Usage_Hints=NO_HINTS) const
static size_t window_bits(size_t exp_bits, size_t base_bits, Power_Mod::Usage_Hints hints)
Power_Mod & operator=(const Power_Mod &)
Power_Mod(const BigInt &=0, Usage_Hints=NO_HINTS)
std::invalid_argument Invalid_Argument
Library_State & global_state()
Internal_Error(const std::string &err)
Lookup_Error(const std::string &err)