Botan  1.10.9
def_powm.h
Go to the documentation of this file.
1 /*
2 * Modular Exponentiation
3 * (C) 1999-2007 Jack Lloyd
4 *
5 * Distributed under the terms of the Botan license
6 */
7 
8 #ifndef BOTAN_DEFAULT_MODEXP_H__
9 #define BOTAN_DEFAULT_MODEXP_H__
10 
11 #include <botan/pow_mod.h>
12 #include <botan/reducer.h>
13 #include <vector>
14 
15 namespace Botan {
16 
17 /**
18 * Fixed Window Exponentiator
19 */
21  {
22  public:
23  void set_exponent(const BigInt&);
24  void set_base(const BigInt&);
25  BigInt execute() const;
26 
28  { return new Fixed_Window_Exponentiator(*this); }
29 
31  private:
32  Modular_Reducer reducer;
33  BigInt exp;
34  size_t window_bits;
35  std::vector<BigInt> g;
37  };
38 
39 /**
40 * Montgomery Exponentiator
41 */
43  {
44  public:
45  void set_exponent(const BigInt&);
46  void set_base(const BigInt&);
47  BigInt execute() const;
48 
50  { return new Montgomery_Exponentiator(*this); }
51 
53  private:
54  BigInt exp, modulus;
55  BigInt R2, R_mod;
56  std::vector<BigInt> g;
57  word mod_prime;
58  size_t mod_words, exp_bits, window_bits;
60  };
61 
62 }
63 
64 #endif
Fixed_Window_Exponentiator(const BigInt &, Power_Mod::Usage_Hints)
Definition: powm_fw.cpp:61
Modular_Exponentiator * copy() const
Definition: def_powm.h:27
void set_exponent(const BigInt &)
Definition: powm_mnt.cpp:17
Montgomery_Exponentiator(const BigInt &, Power_Mod::Usage_Hints)
Definition: powm_mnt.cpp:127
void set_base(const BigInt &)
Definition: powm_mnt.cpp:26
void set_base(const BigInt &)
Definition: powm_fw.cpp:25
void set_exponent(const BigInt &)
Definition: powm_fw.cpp:17
Modular_Exponentiator * copy() const
Definition: def_powm.h:49