aboutsummaryrefslogtreecommitdiffstats
path: root/src/math/numbertheory/powm_fw.cpp
diff options
context:
space:
mode:
authorlloyd <[email protected]>2009-03-30 18:27:18 +0000
committerlloyd <[email protected]>2009-03-30 18:27:18 +0000
commit96d6eb6f29c55e16a37cf11899547886f735b065 (patch)
tree9f13901e9b44c98d58b2589c9b09c6a7443eb7cd /src/math/numbertheory/powm_fw.cpp
parent3cc3dd72c5f87b76852a55c1f2d1821dba967d8c (diff)
Thomas Moschny passed along a request from the Fedora packagers which came
up during the Fedora submission review, that each source file include some text about the license. One handy Perl script later and each file now has the line Distributed under the terms of the Botan license after the copyright notices. While I was in there modifying every file anyway, I also stripped out the remainder of the block comments (lots of astericks before and after the text); this is stylistic thing I picked up when I was first learning C++ but in retrospect it is not a good style as the structure makes it harder to modify comments (with the result that comments become fewer, shorter and are less likely to be updated, which are not good things).
Diffstat (limited to 'src/math/numbertheory/powm_fw.cpp')
-rw-r--r--src/math/numbertheory/powm_fw.cpp40
1 files changed, 21 insertions, 19 deletions
diff --git a/src/math/numbertheory/powm_fw.cpp b/src/math/numbertheory/powm_fw.cpp
index c29b9f311..b764ee7aa 100644
--- a/src/math/numbertheory/powm_fw.cpp
+++ b/src/math/numbertheory/powm_fw.cpp
@@ -1,7 +1,9 @@
-/*************************************************
-* Fixed Window Exponentiation Source File *
-* (C) 1999-2007 Jack Lloyd *
-*************************************************/
+/*
+* Fixed Window Exponentiation
+* (C) 1999-2007 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
#include <botan/def_powm.h>
#include <botan/numthry.h>
@@ -11,9 +13,9 @@ namespace Botan {
namespace {
-/*************************************************
-* Try to choose a good window size *
-*************************************************/
+/*
+* Try to choose a good window size
+*/
u32bit choose_window_bits(u32bit exp_bits, u32bit,
Power_Mod::Usage_Hints hints)
{
@@ -47,17 +49,17 @@ u32bit choose_window_bits(u32bit exp_bits, u32bit,
}
-/*************************************************
-* Set the exponent *
-*************************************************/
+/*
+* Set the exponent
+*/
void Fixed_Window_Exponentiator::set_exponent(const BigInt& e)
{
exp = e;
}
-/*************************************************
-* Set the base *
-*************************************************/
+/*
+* Set the base
+*/
void Fixed_Window_Exponentiator::set_base(const BigInt& base)
{
window_bits = choose_window_bits(exp.bits(), base.bits(), hints);
@@ -68,9 +70,9 @@ void Fixed_Window_Exponentiator::set_base(const BigInt& base)
g[j] = reducer.multiply(g[j-1], g[0]);
}
-/*************************************************
-* Compute the result *
-*************************************************/
+/*
+* Compute the result
+*/
BigInt Fixed_Window_Exponentiator::execute() const
{
const u32bit exp_nibbles = (exp.bits() + window_bits - 1) / window_bits;
@@ -88,9 +90,9 @@ BigInt Fixed_Window_Exponentiator::execute() const
return x;
}
-/*************************************************
-* Fixed_Window_Exponentiator Constructor *
-*************************************************/
+/*
+* Fixed_Window_Exponentiator Constructor
+*/
Fixed_Window_Exponentiator::Fixed_Window_Exponentiator(const BigInt& n,
Power_Mod::Usage_Hints hints)
{