Botan 1.10.17

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*
17 Core_Engine::mod_exp(const BigInt& n, Power_Mod::Usage_Hints hints) const
18 {
19 if(n.is_odd())
20 return new Montgomery_Exponentiator(n, hints);
21 return new Fixed_Window_Exponentiator(n, hints);
22 }
23
24 }
Botan::BigInt
Definition: bigint.h:22
Botan::Core_Engine::mod_exp
Modular_Exponentiator * mod_exp(const BigInt &n, Power_Mod::Usage_Hints) const
Definition: def_powm.cpp:17
Botan
Definition: algo_base.h:14
Botan::Montgomery_Exponentiator
Definition: def_powm.h:42
Botan::Power_Mod::Usage_Hints
Usage_Hints
Definition: pow_mod.h:35
Botan::Fixed_Window_Exponentiator
Definition: def_powm.h:20