diff --git a/td_tp/tp3/src/df.c b/td_tp/tp3/src/df.c index 1e2ffa5..b1bf962 100644 --- a/td_tp/tp3/src/df.c +++ b/td_tp/tp3/src/df.c @@ -7,7 +7,11 @@ uint64 expm(uint64 m, uint64 e, uint64 mod) uint128 _mod = (uint128)mod; - // TODO + while (e){ + if (e & 1) _r=(_r*_m)%_mod; + _m=(_m*_m)%_mod; + e>>=1; + } return (uint64)_r; } @@ -17,7 +21,10 @@ uint64 generateur(uint64 p) uint64 g=2; uint64 r=1; - // TODO + while(r==1){ + expm(g,(p-1)/2,p) + g++; + } }