Botan  1.10.9
def_powm.cpp
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 #include <botan/internal/core_engine.h>
9 #include <botan/internal/def_powm.h>
10 
11 namespace Botan {
12 
13 /*
14 * Choose a modular exponentation algorithm
15 */
16 Modular_Exponentiator*
18  {
19  if(n.is_odd())
20  return new Montgomery_Exponentiator(n, hints);
21  return new Fixed_Window_Exponentiator(n, hints);
22  }
23 
24 }
bool is_odd() const
Definition: bigint.h:164
BigInt n
Definition: numthry.cpp:26
Modular_Exponentiator * mod_exp(const BigInt &n, Power_Mod::Usage_Hints) const
Definition: def_powm.cpp:17