Crypto++

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

modexppc.h

    00001 #ifndef CRYPTOPP_MODEXPPC_H
    00002 #define CRYPTOPP_MODEXPPC_H
    00003
    00004 #include "modarith.h"
    00005 #include "eprecomp.h"
    00006 #include "smartptr.h"
    00007 #include "pubkey.h"
    00008
    00009 NAMESPACE_BEGIN(CryptoPP)
    00010
    00011 CRYPTOPP_DLL_TEMPLATE_CLASS DL_FixedBasePrecomputationImpl<Integer>;
    00012
    00013 class ModExpPrecomputation : public DL_GroupPrecomputation<Integer>
    00014 {
    00015 public:
    00016     // DL_GroupPrecomputation
    00017     bool NeedConversions() const {return true;}
    00018     Element ConvertIn(const Element &v) const {return m_mr->ConvertIn(v);}
    00019     virtual Element ConvertOut(const Element &v) const {return m_mr->ConvertOut(v);}
    00020     const AbstractGroup<Element> & GetGroup() const {return m_mr->MultiplicativeGroup();}
    00021     Element BERDecodeElement(BufferedTransformation &bt) const {return Integer(bt);}
    00022     void DEREncodeElement(BufferedTransformation &bt, const Element &v) const {v.DEREncode(bt);}
    00023
    00024     // non-inherited
    00025     void SetModulus(const Integer &v) {m_mr.reset(new MontgomeryRepresentation(v));}
    00026     const Integer & GetModulus() const {return m_mr->GetModulus();}
    00027
    00028 private:
    00029     value_ptr<MontgomeryRepresentation> m_mr;
    00030 };
    00031
    00032 NAMESPACE_END
    00033
    00034 #endif