Botan  2.6.0
Crypto and TLS for C++11
Public Member Functions | List of all members
Botan::Montgomery_Exponentiator Class Referencefinal

#include <def_powm.h>

Inheritance diagram for Botan::Montgomery_Exponentiator:
Botan::Modular_Exponentiator

Public Member Functions

Modular_Exponentiatorcopy () const override
 
BigInt execute () const override
 
 Montgomery_Exponentiator (const BigInt &, Power_Mod::Usage_Hints)
 
void set_base (const BigInt &) override
 
void set_exponent (const BigInt &) override
 

Detailed Description

Montgomery Exponentiator

Definition at line 45 of file def_powm.h.

Constructor & Destructor Documentation

◆ Montgomery_Exponentiator()

Botan::Montgomery_Exponentiator::Montgomery_Exponentiator ( const BigInt mod,
Power_Mod::Usage_Hints  hints 
)

Definition at line 32 of file powm_mnt.cpp.

Referenced by copy().

33  :
34  m_p(mod),
35  m_mod_p(mod),
36  m_monty_params(std::make_shared<Montgomery_Params>(m_p, m_mod_p)),
37  m_hints(hints)
38  {
39  }

Member Function Documentation

◆ copy()

Modular_Exponentiator* Botan::Montgomery_Exponentiator::copy ( ) const
inlineoverridevirtual

Implements Botan::Modular_Exponentiator.

Definition at line 52 of file def_powm.h.

References Montgomery_Exponentiator().

53  { return new Montgomery_Exponentiator(*this); }
Montgomery_Exponentiator(const BigInt &, Power_Mod::Usage_Hints)
Definition: powm_mnt.cpp:32

◆ execute()

BigInt Botan::Montgomery_Exponentiator::execute ( ) const
overridevirtual

Implements Botan::Modular_Exponentiator.

Definition at line 27 of file powm_mnt.cpp.

References Botan::monty_execute().

28  {
29  return monty_execute(*m_monty, m_e);
30  }
BigInt monty_execute(const Montgomery_Exponentation_State &precomputed_state, const BigInt &k)
Definition: monty_exp.cpp:149

◆ set_base()

void Botan::Montgomery_Exponentiator::set_base ( const BigInt base)
overridevirtual

Implements Botan::Modular_Exponentiator.

Definition at line 21 of file powm_mnt.cpp.

References Botan::BigInt::bits(), Botan::monty_precompute(), and Botan::Power_Mod::window_bits().

22  {
23  size_t window_bits = Power_Mod::window_bits(m_e.bits(), base.bits(), m_hints);
24  m_monty = monty_precompute(m_monty_params, base, window_bits);
25  }
std::shared_ptr< const Montgomery_Exponentation_State > monty_precompute(std::shared_ptr< const Montgomery_Params > params, const BigInt &g, size_t window_bits)
Definition: monty_exp.cpp:142
size_t bits() const
Definition: bigint.cpp:216
static size_t window_bits(size_t exp_bits, size_t base_bits, Power_Mod::Usage_Hints hints)
Definition: pow_mod.cpp:102

◆ set_exponent()

void Botan::Montgomery_Exponentiator::set_exponent ( const BigInt exp)
overridevirtual

Implements Botan::Modular_Exponentiator.

Definition at line 16 of file powm_mnt.cpp.

17  {
18  m_e = exp;
19  }

The documentation for this class was generated from the following files: