8 #include <botan/internal/gnump_engine.h> 9 #include <botan/internal/gmp_wrap.h> 18 class GMP_Modular_Exponentiator :
public Modular_Exponentiator
21 void set_base(
const BigInt& b) { base = b; }
22 void set_exponent(
const BigInt& e) { exp = e; }
23 BigInt execute()
const;
24 Modular_Exponentiator* copy()
const 25 {
return new GMP_Modular_Exponentiator(*
this); }
27 GMP_Modular_Exponentiator(
const BigInt& n) : mod(n) {}
29 GMP_MPZ base, exp, mod;
35 BigInt GMP_Modular_Exponentiator::execute()
const 38 mpz_powm(r.value, base.value, exp.value, mod.value);
50 return new GMP_Modular_Exponentiator(n);
Modular_Exponentiator * mod_exp(const BigInt &, Power_Mod::Usage_Hints) const