modexppc.h
#ifndef CRYPTOPP_MODEXPPC_H
#define CRYPTOPP_MODEXPPC_H
#include "cryptlib.h"
#include "modarith.h"
#include "integer.h"
#include "algebra.h"
#include "eprecomp.h"
#include "smartptr.h"
#include "pubkey.h"
#if CRYPTOPP_MSC_VERSION
# pragma warning(push)
# pragma warning(disable: 4231 4275)
#endif
NAMESPACE_BEGIN(CryptoPP)
CRYPTOPP_DLL_TEMPLATE_CLASS DL_FixedBasePrecomputationImpl<Integer>;
class ModExpPrecomputation : public DL_GroupPrecomputation<Integer>
{
public:
virtual ~ModExpPrecomputation() {}
// DL_GroupPrecomputation
bool NeedConversions() const {return true;}
Element ConvertIn(const Element &v) const {return m_mr->ConvertIn(v);}
virtual Element ConvertOut(const Element &v) const {return m_mr->ConvertOut(v);}
const AbstractGroup<Element> & GetGroup() const {return m_mr->MultiplicativeGroup();}
Element BERDecodeElement(BufferedTransformation &bt) const {return Integer(bt);}
void DEREncodeElement(BufferedTransformation &bt, const Element &v) const {v.DEREncode(bt);}
// non-inherited
void SetModulus(const Integer &v) {m_mr.reset(new MontgomeryRepresentation(v));}
const Integer & GetModulus() const {return m_mr->GetModulus();}
private:
value_ptr<MontgomeryRepresentation> m_mr;
};
NAMESPACE_END
#if CRYPTOPP_MSC_VERSION
# pragma warning(pop)
#endif
#endif
algebra.h
Classes for performing mathematics over different fields.
AbstractGroup
Abstract group.
Definition: algebra.h:27
BufferedTransformation
Interface for buffered transformations.
Definition: cryptlib.h:1652
DL_FixedBasePrecomputationImpl
DL_FixedBasePrecomputation adapter class.
Definition: eprecomp.h:127
DL_GroupPrecomputation
DL_GroupPrecomputation interface.
Definition: eprecomp.h:20
Integer
Multiple precision integer with arithmetic operations.
Definition: integer.h:50
Integer::DEREncode
void DEREncode(BufferedTransformation &bt) const
Encode in DER format.
ModExpPrecomputation
Definition: modexppc.h:22
ModExpPrecomputation::DEREncodeElement
void DEREncodeElement(BufferedTransformation &bt, const Element &v) const
Encodes element in DER format.
Definition: modexppc.h:32
ModExpPrecomputation::GetGroup
const AbstractGroup< Element > & GetGroup() const
Retrieves AbstractGroup interface.
Definition: modexppc.h:30
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
ModExpPrecomputation::ConvertIn
Element ConvertIn(const Element &v) const
Converts an element between representations.
Definition: modexppc.h:28
ModExpPrecomputation::BERDecodeElement
Element BERDecodeElement(BufferedTransformation &bt) const
Decodes element in DER format.
Definition: modexppc.h:31
MontgomeryRepresentation
Performs modular arithmetic in Montgomery representation for increased speed.
Definition: modarith.h:296
value_ptr< MontgomeryRepresentation >
CRYPTOPP_DLL_TEMPLATE_CLASS
#define CRYPTOPP_DLL_TEMPLATE_CLASS
Instantiate templates in a dynamic library.
Definition: config_dll.h:72
cryptlib.h
Abstract base classes that provide a uniform interface to this library.
eprecomp.h
Classes for precomputation in a group.
integer.h
Multiple precision integer with arithmetic operations.
modarith.h
Class file for performing modular arithmetic.
CryptoPP
Crypto++ library namespace.
pubkey.h
This file contains helper classes/functions for implementing public key algorithms.
smartptr.h
Classes for automatic resource management.