From 17231ebbb95cc45cca50eabc4799c3058fc78ee9 Mon Sep 17 00:00:00 2001 From: lloyd Date: Sun, 26 Oct 2008 02:18:05 +0000 Subject: Move libstate and selftest out of core/ dir to toplevel --- src/libstate/def_powm.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 src/libstate/def_powm.cpp (limited to 'src/libstate/def_powm.cpp') diff --git a/src/libstate/def_powm.cpp b/src/libstate/def_powm.cpp new file mode 100644 index 000000000..a28438f5b --- /dev/null +++ b/src/libstate/def_powm.cpp @@ -0,0 +1,22 @@ +/************************************************* +* Modular Exponentiation Source File * +* (C) 1999-2007 Jack Lloyd * +*************************************************/ + +#include +#include + +namespace Botan { + +/************************************************* +* Choose a modular exponentation algorithm * +*************************************************/ +Modular_Exponentiator* +Default_Engine::mod_exp(const BigInt& n, Power_Mod::Usage_Hints hints) const + { + if(n.is_odd()) + return new Montgomery_Exponentiator(n, hints); + return new Fixed_Window_Exponentiator(n, hints); + } + +} -- cgit v1.2.3