MCPcopy Create free account
hub / github.com/data61/MP-SPDZ / powerMod

Function powerMod

Math/bigint.cpp:18–30  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

16
17
18bigint powerMod(const bigint& x,const bigint& e,const bigint& p)
19{
20 bigint ans;
21 if (e>=0)
22 { mpz_powm(ans.get_mpz_t(),x.get_mpz_t(),e.get_mpz_t(),p.get_mpz_t()); }
23 else
24 { bigint xi,ei=-e;
25 invMod(xi,x,p);
26 mpz_powm(ans.get_mpz_t(),xi.get_mpz_t(),ei.get_mpz_t(),p.get_mpz_t());
27 }
28
29 return ans;
30}
31
32
33int powerMod(int x,int e,int p)

Callers 2

assignMethod · 0.85
nth_elementMethod · 0.85

Calls 2

invModFunction · 0.85
not_implementedClass · 0.85

Tested by

no test coverage detected