Compare commits

...

2 Commits
main ... main

Author SHA1 Message Date
bb48e4c3de generateur fait 2025-03-20 17:05:50 +01:00
824aecf3e9 il faut faire le générateur dans df.c 2025-03-20 16:13:50 +01:00
2 changed files with 18 additions and 2 deletions
td_tp/tp3/src

@ -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

Binary file not shown.