00001 #ifndef CRYPTOPP_EPRECOMP_H
00002 #define CRYPTOPP_EPRECOMP_H
00003
00004 #include "integer.h"
00005 #include "algebra.h"
00006 #include <vector>
00007
00008 NAMESPACE_BEGIN(CryptoPP)
00009
00019 template <class T> class ExponentiationPrecomputation
00020 {
00021 public:
00022 typedef T Element;
00023 typedef AbstractGroup<T> Group;
00024
00025 ExponentiationPrecomputation() : m_group(NULL) {}
00026
00027 void SetGroupAndBase(const Group &group, const Element &base);
00028 void Precompute(unsigned int maxExpBits, unsigned int storage);
00029 void PrepareCascade(std::vector<BaseAndExponent<Element> > &eb, const Integer &exponent) const;
00030 Element Exponentiate(const Integer &exponent) const;
00031 Element CascadeExponentiate(const Integer &exponent, const ExponentiationPrecomputation<T> &pc2, const Integer &exponent2) const;
00032
00033 const Group *m_group;
00034 unsigned int m_windowSize;
00035 Integer m_exponentBase;
00036 std::vector<Element> m_bases;
00037 };
00038
00039 NAMESPACE_END
00040
00041 #endif