Crypto++ 8.2 Free C++ class library of cryptographic schemes

modexppc.h
1 #ifndef CRYPTOPP_MODEXPPC_H
2 #define CRYPTOPP_MODEXPPC_H
3
4 #include "cryptlib.h"
5 #include "modarith.h"
6 #include "integer.h"
7 #include "algebra.h"
8 #include "eprecomp.h"
9 #include "smartptr.h"
10 #include "pubkey.h"
11
12 #if CRYPTOPP_MSC_VERSION
13 # pragma warning(push)
14 # pragma warning(disable: 4231 4275)
15 #endif
16
17 NAMESPACE_BEGIN(CryptoPP)
18
19 CRYPTOPP_DLL_TEMPLATE_CLASS DL_FixedBasePrecomputationImpl<Integer>;
20
21 class ModExpPrecomputation : public DL_GroupPrecomputation<Integer>
22 {
23 public:
24 virtual ~ModExpPrecomputation() {}
25
26 // DL_GroupPrecomputation
27 bool NeedConversions() const {return true;}
28 Element ConvertIn(const Element &v) const {return m_mr->ConvertIn(v);}
29 virtual Element ConvertOut(const Element &v) const {return m_mr->ConvertOut(v);}
30 const AbstractGroup<Element> & GetGroup() const {return m_mr->MultiplicativeGroup();}
31 Element BERDecodeElement(BufferedTransformation &bt) const {return Integer(bt);}
32 void DEREncodeElement(BufferedTransformation &bt, const Element &v) const {v.DEREncode(bt);}
33
34 // non-inherited
35 void SetModulus(const Integer &v) {m_mr.reset(new MontgomeryRepresentation(v));}
36 const Integer & GetModulus() const {return m_mr->GetModulus();}
37
38 private:
39 value_ptr<MontgomeryRepresentation> m_mr;
40 };
41
42 NAMESPACE_END
43
44 #if CRYPTOPP_MSC_VERSION
45 # pragma warning(pop)
46 #endif
47
48 #endif
ModExpPrecomputation::ConvertOut
virtual Element ConvertOut(const Element &v) const
Converts an element between representations.
Definition: modexppc.h:29
ModExpPrecomputation::NeedConversions
bool NeedConversions() const
Determines if elements needs conversion.
Definition: modexppc.h:27
DL_GroupPrecomputation
DL_GroupPrecomputation interface.
Definition: eprecomp.h:19
Integer::DEREncode
void DEREncode(BufferedTransformation &bt) const
Encode in DER format.
Definition: integer.cpp:3433
pubkey.h
This file contains helper classes/functions for implementing public key algorithms.
cryptlib.h
Abstract base classes that provide a uniform interface to this library.
smartptr.h
Classes for automatic resource management.
ModExpPrecomputation::ConvertIn
Element ConvertIn(const Element &v) const
Converts an element between representations.
Definition: modexppc.h:28
algebra.h
Classes for performing mathematics over different fields.
BufferedTransformation
Interface for buffered transformations.
Definition: cryptlib.h:1630
ModExpPrecomputation::BERDecodeElement
Element BERDecodeElement(BufferedTransformation &bt) const
Decodes element in DER format.
Definition: modexppc.h:31
Integer
Multiple precision integer with arithmetic operations.
Definition: integer.h:49
ModExpPrecomputation
Definition: modexppc.h:21
AbstractGroup
Abstract group.
Definition: algebra.h:26
eprecomp.h
Classes for precomputation in a group.
MontgomeryRepresentation
Performs modular arithmetic in Montgomery representation for increased speed.
Definition: modarith.h:295
ModExpPrecomputation::DEREncodeElement
void DEREncodeElement(BufferedTransformation &bt, const Element &v) const
Encodes element in DER format.
Definition: modexppc.h:32
value_ptr< MontgomeryRepresentation >
integer.h
Multiple precision integer with arithmetic operations.
modarith.h
Class file for performing modular arithmetic.
CryptoPP
Crypto++ library namespace.
ModExpPrecomputation::GetGroup
const AbstractGroup< Element > & GetGroup() const
Retrieves AbstractGroup interface.
Definition: modexppc.h:30
DL_FixedBasePrecomputationImpl
DL_FixedBasePrecomputation adapter class.
Definition: eprecomp.h:126