aboutsummaryrefslogtreecommitdiffstats
path: root/src/math/numbertheory/powm_fw.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/math/numbertheory/powm_fw.cpp')
-rw-r--r--src/math/numbertheory/powm_fw.cpp40
1 files changed, 1 insertions, 39 deletions
diff --git a/src/math/numbertheory/powm_fw.cpp b/src/math/numbertheory/powm_fw.cpp
index 1cfcdcd66..68dabc332 100644
--- a/src/math/numbertheory/powm_fw.cpp
+++ b/src/math/numbertheory/powm_fw.cpp
@@ -11,44 +11,6 @@
namespace Botan {
-namespace {
-
-/*
-* Try to choose a good window size
-*/
-u32bit fw_powm_window_bits(u32bit exp_bits, u32bit,
- Power_Mod::Usage_Hints hints)
- {
- static const u32bit wsize[][2] = {
- { 2048, 7 }, { 1024, 6 }, { 256, 5 }, { 128, 4 }, { 64, 3 }, { 0, 0 }
- };
-
- u32bit window_bits = 3;
-
- if(exp_bits)
- {
- for(u32bit j = 0; wsize[j][0]; ++j)
- {
- if(exp_bits >= wsize[j][0])
- {
- window_bits += wsize[j][1];
- break;
- }
- }
- }
-
- if(hints & Power_Mod::EXP_IS_FIXED)
- window_bits += 2;
- if(hints & Power_Mod::EXP_IS_LARGE)
- window_bits += 2;
- if(hints & Power_Mod::BASE_IS_FIXED)
- ++window_bits;
-
- return window_bits;
- }
-
-}
-
/*
* Set the exponent
*/
@@ -62,7 +24,7 @@ void Fixed_Window_Exponentiator::set_exponent(const BigInt& e)
*/
void Fixed_Window_Exponentiator::set_base(const BigInt& base)
{
- window_bits = fw_powm_window_bits(exp.bits(), base.bits(), hints);
+ window_bits = Power_Mod::window_bits(exp.bits(), base.bits(), hints);
g.resize((1 << window_bits) - 1);
g[0] = base;