Botan
1.10.17
src
engine
core_engine
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:23
Botan::BigInt::is_odd
bool is_odd() const
Definition
bigint.h:164
Botan::Core_Engine::mod_exp
Modular_Exponentiator * mod_exp(const BigInt &n, Power_Mod::Usage_Hints) const
Definition
def_powm.cpp:17
Botan::Fixed_Window_Exponentiator::Fixed_Window_Exponentiator
Fixed_Window_Exponentiator(const BigInt &, Power_Mod::Usage_Hints)
Definition
powm_fw.cpp:61
Botan::Modular_Exponentiator
Definition
pow_mod.h:19
Botan::Montgomery_Exponentiator::Montgomery_Exponentiator
Montgomery_Exponentiator(const BigInt &, Power_Mod::Usage_Hints)
Definition
powm_mnt.cpp:130
Botan::Power_Mod::Usage_Hints
Usage_Hints
Definition
pow_mod.h:35
Botan
Definition
algo_base.h:14
Generated by
1.18.0