Botan
1.10.9
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
src
math
numbertheory
def_powm.h
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
#ifndef BOTAN_DEFAULT_MODEXP_H__
9
#define BOTAN_DEFAULT_MODEXP_H__
10
11
#include <botan/pow_mod.h>
12
#include <botan/reducer.h>
13
#include <vector>
14
15
namespace
Botan
{
16
17
/**
18
* Fixed Window Exponentiator
19
*/
20
class
Fixed_Window_Exponentiator
:
public
Modular_Exponentiator
21
{
22
public
:
23
void
set_exponent
(
const
BigInt
&);
24
void
set_base
(
const
BigInt
&);
25
BigInt
execute
()
const
;
26
27
Modular_Exponentiator
*
copy
()
const
28
{
return
new
Fixed_Window_Exponentiator
(*
this
); }
29
30
Fixed_Window_Exponentiator
(
const
BigInt
&,
Power_Mod::Usage_Hints
);
31
private
:
32
Modular_Reducer
reducer;
33
BigInt
exp;
34
size_t
window_bits;
35
std::vector<BigInt> g;
36
Power_Mod::Usage_Hints
hints;
37
};
38
39
/**
40
* Montgomery Exponentiator
41
*/
42
class
Montgomery_Exponentiator
:
public
Modular_Exponentiator
43
{
44
public
:
45
void
set_exponent
(
const
BigInt
&);
46
void
set_base
(
const
BigInt
&);
47
BigInt
execute
()
const
;
48
49
Modular_Exponentiator
*
copy
()
const
50
{
return
new
Montgomery_Exponentiator
(*
this
); }
51
52
Montgomery_Exponentiator
(
const
BigInt
&,
Power_Mod::Usage_Hints
);
53
private
:
54
BigInt
exp, modulus;
55
BigInt
R2, R_mod;
56
std::vector<BigInt> g;
57
word mod_prime;
58
size_t
mod_words, exp_bits, window_bits;
59
Power_Mod::Usage_Hints
hints;
60
};
61
62
}
63
64
#endif
Botan::Fixed_Window_Exponentiator::Fixed_Window_Exponentiator
Fixed_Window_Exponentiator(const BigInt &, Power_Mod::Usage_Hints)
Definition:
powm_fw.cpp:61
Botan::BigInt
Definition:
bigint.h:22
Botan::Fixed_Window_Exponentiator::copy
Modular_Exponentiator * copy() const
Definition:
def_powm.h:27
Botan::Montgomery_Exponentiator::set_exponent
void set_exponent(const BigInt &)
Definition:
powm_mnt.cpp:17
Botan::Fixed_Window_Exponentiator::execute
BigInt execute() const
Definition:
powm_fw.cpp:40
Botan::Montgomery_Exponentiator::Montgomery_Exponentiator
Montgomery_Exponentiator(const BigInt &, Power_Mod::Usage_Hints)
Definition:
powm_mnt.cpp:127
Botan
Definition:
algo_base.h:14
Botan::Montgomery_Exponentiator
Definition:
def_powm.h:42
Botan::Power_Mod::Usage_Hints
Usage_Hints
Definition:
pow_mod.h:35
Botan::Fixed_Window_Exponentiator
Definition:
def_powm.h:20
Botan::Montgomery_Exponentiator::set_base
void set_base(const BigInt &)
Definition:
powm_mnt.cpp:26
Botan::Fixed_Window_Exponentiator::set_base
void set_base(const BigInt &)
Definition:
powm_fw.cpp:25
Botan::Fixed_Window_Exponentiator::set_exponent
void set_exponent(const BigInt &)
Definition:
powm_fw.cpp:17
Botan::Montgomery_Exponentiator::execute
BigInt execute() const
Definition:
powm_mnt.cpp:77
Botan::Modular_Reducer
Definition:
reducer.h:18
Botan::Montgomery_Exponentiator::copy
Modular_Exponentiator * copy() const
Definition:
def_powm.h:49
Botan::Modular_Exponentiator
Definition:
pow_mod.h:18
Generated on Sat Aug 20 2016 08:18:48 for Botan by
1.8.9.1