source: git/src-cryptopp/modexppc.h

Last change on this file was e230cb0, checked in by David Stainton <dstainton415@…>, at 2016-10-12T13:27:29Z

Add cryptopp from tag CRYPTOPP_5_6_5

  • Property mode set to 100644
File size: 1.1 KB
Line 
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
12NAMESPACE_BEGIN(CryptoPP)
13
14CRYPTOPP_DLL_TEMPLATE_CLASS DL_FixedBasePrecomputationImpl<Integer>;
15
16class ModExpPrecomputation : public DL_GroupPrecomputation<Integer>
17{
18public:
19        // DL_GroupPrecomputation
20        bool NeedConversions() const {return true;}
21        Element ConvertIn(const Element &v) const {return m_mr->ConvertIn(v);}
22        virtual Element ConvertOut(const Element &v) const {return m_mr->ConvertOut(v);}
23        const AbstractGroup<Element> & GetGroup() const {return m_mr->MultiplicativeGroup();}
24        Element BERDecodeElement(BufferedTransformation &bt) const {return Integer(bt);}
25        void DEREncodeElement(BufferedTransformation &bt, const Element &v) const {v.DEREncode(bt);}
26
27        // non-inherited
28        void SetModulus(const Integer &v) {m_mr.reset(new MontgomeryRepresentation(v));}
29        const Integer & GetModulus() const {return m_mr->GetModulus();}
30
31private:
32        value_ptr<MontgomeryRepresentation> m_mr;
33};
34
35NAMESPACE_END
36
37#endif
Note: See TracBrowser for help on using the repository browser.