#include "pch.h" #include "eprecomp.h" #include "algebra.h" #include USING_NAMESPACE(std) template void ExponentiationPrecomputation::Precompute(const Element &base, unsigned int maxExpBits) { assert(storage <= maxExpBits); exponentBase = Integer::Power2((maxExpBits+storage-1)/storage); g[0] = base; for (unsigned i=1; i typename ExponentiationPrecomputation::Element ExponentiationPrecomputation::Exponentiate(const Integer &exponent) const { vector > eb(storage); // array of segments of the exponent and precalculated bases Integer temp, e = exponent; unsigned i; for (i=0; i+1(group, eb.begin(), eb.end()); } template typename ExponentiationPrecomputation::Element ExponentiationPrecomputation::CascadeExponentiate(const Integer &exponent, const ExponentiationPrecomputation &pc2, const Integer &exponent2) const { vector > eb(storage+pc2.storage); // array of segments of the exponent and precalculated bases Integer temp, e = exponent; unsigned i; for (i=0; i+1(group, eb.begin(), eb.end()); }