Botan 1.10.17
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
15namespace Botan {
16
17/**
18* Fixed Window Exponentiator
19*/
21 {
22 public:
23 void set_exponent(const BigInt&);
24 void set_base(const BigInt&);
25 BigInt execute() const;
26
28 { return new Fixed_Window_Exponentiator(*this); }
29
31 private:
32 Modular_Reducer reducer;
33 BigInt exp;
34 size_t window_bits;
35 std::vector<BigInt> g;
37 };
38
39/**
40* Montgomery Exponentiator
41*/
43 {
44 public:
45 void set_exponent(const BigInt&);
46 void set_base(const BigInt&);
47 BigInt execute() const;
48
50 { return new Montgomery_Exponentiator(*this); }
51
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;
60 };
61
62}
63
64#endif
#define R2
Definition asm_x86_64.h:53
Modular_Exponentiator * copy() const
Definition def_powm.h:27
void set_exponent(const BigInt &)
Definition powm_fw.cpp:17
Fixed_Window_Exponentiator(const BigInt &, Power_Mod::Usage_Hints)
Definition powm_fw.cpp:61
void set_base(const BigInt &)
Definition powm_fw.cpp:25
Modular_Exponentiator * copy() const
Definition def_powm.h:49
Montgomery_Exponentiator(const BigInt &, Power_Mod::Usage_Hints)
Definition powm_mnt.cpp:130
void set_exponent(const BigInt &)
Definition powm_mnt.cpp:17
void set_base(const BigInt &)
Definition powm_mnt.cpp:26