aboutsummaryrefslogtreecommitdiffstats
path: root/src/math
diff options
context:
space:
mode:
authorlloyd <[email protected]>2012-06-15 20:07:39 +0000
committerlloyd <[email protected]>2012-06-15 20:07:39 +0000
commitaab06ec56681823a7f7f724211abb46633e2ef55 (patch)
tree625ea1dc130929faa951363fe2db42a017791d6c /src/math
parent105d9add3baa1d69a6331de8a91c7ebe904a6c0e (diff)
Index, comments, name vars in headers
Diffstat (limited to 'src/math')
-rw-r--r--src/math/numbertheory/numthry.cpp6
-rw-r--r--src/math/numbertheory/pow_mod.h12
-rw-r--r--src/math/numbertheory/powm_fw.cpp2
3 files changed, 15 insertions, 5 deletions
diff --git a/src/math/numbertheory/numthry.cpp b/src/math/numbertheory/numthry.cpp
index 18f6ce429..c6816219f 100644
--- a/src/math/numbertheory/numthry.cpp
+++ b/src/math/numbertheory/numthry.cpp
@@ -253,6 +253,12 @@ BigInt inverse_mod(const BigInt& n, const BigInt& mod)
BigInt power_mod(const BigInt& base, const BigInt& exp, const BigInt& mod)
{
Power_Mod pow_mod(mod);
+
+ /*
+ * Calling set_base before set_exponent means we end up using a
+ * minimal window. This makes sense given that here we know that any
+ * precomputation is wasted.
+ */
pow_mod.set_base(base);
pow_mod.set_exponent(exp);
return pow_mod.execute();
diff --git a/src/math/numbertheory/pow_mod.h b/src/math/numbertheory/pow_mod.h
index 9857c1833..b78510793 100644
--- a/src/math/numbertheory/pow_mod.h
+++ b/src/math/numbertheory/pow_mod.h
@@ -77,8 +77,10 @@ class BOTAN_DLL Fixed_Exponent_Power_Mod : public Power_Mod
{ set_base(b); return execute(); }
Fixed_Exponent_Power_Mod() {}
- Fixed_Exponent_Power_Mod(const BigInt&, const BigInt&,
- Usage_Hints = NO_HINTS);
+
+ Fixed_Exponent_Power_Mod(const BigInt& exponent,
+ const BigInt& modulus,
+ Usage_Hints hints = NO_HINTS);
};
/**
@@ -91,8 +93,10 @@ class BOTAN_DLL Fixed_Base_Power_Mod : public Power_Mod
{ set_exponent(e); return execute(); }
Fixed_Base_Power_Mod() {}
- Fixed_Base_Power_Mod(const BigInt&, const BigInt&,
- Usage_Hints = NO_HINTS);
+
+ Fixed_Base_Power_Mod(const BigInt& base,
+ const BigInt& modulus,
+ Usage_Hints hints = NO_HINTS);
};
}
diff --git a/src/math/numbertheory/powm_fw.cpp b/src/math/numbertheory/powm_fw.cpp
index 3348e55cd..13aeee63b 100644
--- a/src/math/numbertheory/powm_fw.cpp
+++ b/src/math/numbertheory/powm_fw.cpp
@@ -55,7 +55,7 @@ BigInt Fixed_Window_Exponentiator::execute() const
* Fixed_Window_Exponentiator Constructor
*/
Fixed_Window_Exponentiator::Fixed_Window_Exponentiator(const BigInt& n,
- Power_Mod::Usage_Hints hints)
+ Power_Mod::Usage_Hints hints)
{
reducer = Modular_Reducer(n);
this->hints = hints;