Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
bb48e4c3de | |||
824aecf3e9 |
@ -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,19 @@ uint64 generateur(uint64 p)
|
||||
uint64 g=2;
|
||||
uint64 r=1;
|
||||
|
||||
// TODO
|
||||
while(r){
|
||||
if(expm(g,2,p) == 1){
|
||||
g++;
|
||||
continue;
|
||||
}
|
||||
if(expm(g,(p-1)/2,p) == 1){
|
||||
g++;
|
||||
continue;
|
||||
}else{
|
||||
return g;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
BIN
td_tp/tp3/src/test_df
Executable file
BIN
td_tp/tp3/src/test_df
Executable file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user