MCPcopy Create free account
hub / github.com/Tripwire/tripwire-open-source / CascadeExponentiate

Method CascadeExponentiate

src/cryptlib/eprecomp.cpp:36–64  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

34}
35
36template <class T> typename ExponentiationPrecomputation<T>::Element
37 ExponentiationPrecomputation<T>::CascadeExponentiate(const Integer &exponent,
38 const ExponentiationPrecomputation<T> &pc2, const Integer &exponent2) const
39{
40 vector<pair<Integer, Element> > eb(storage+pc2.storage); // array of segments of the exponent and precalculated bases
41 Integer temp, e = exponent;
42 unsigned i;
43
44 for (i=0; i+1<storage; i++)
45 {
46 Integer::Divide(eb[i].first, temp, e, exponentBase);
47 swap(temp, e);
48 eb[i].second = g[i];
49 }
50 eb[i].first = e;
51 eb[i].second = g[i];
52
53 e = exponent2;
54 for (i=storage; i+1<storage+pc2.storage; i++)
55 {
56 Integer::Divide(eb[i].first, temp, e, exponentBase);
57 swap(temp, e);
58 eb[i].second = pc2.g[i-storage];
59 }
60 eb[i].first = e;
61 eb[i].second = pc2.g[i-storage];
62
63 return GeneralCascadeMultiplication<Element>(group, eb.begin(), eb.end());
64}

Callers

nothing calls this directly

Calls 4

DivideFunction · 0.85
swapFunction · 0.85
beginMethod · 0.80
endMethod · 0.80

Tested by

no test coverage detected