Loading tests/rho_pollard.c +16 −5 Changes for tests/rho_pollard.c: 16 added lines, 5 removed lines. Original line number Diff line number Diff line #include <stdarg.h> #include <stdio.h> #include <stdlib.h> #include <time.h> #include <math.h> #include "bignum.h" #include "list.h" Loading @@ -19,14 +21,23 @@ unsigned long int gcd(unsigned long int a, unsigned long int b){ return old_r; } unsigned long int f(x) { int f(x) { return x*x+1; } bignum_t has_cycle(list_t l) { int n = list_len(l); bignum_t x; int has_cycle(list_t l, int n) { srand(time(NULL)); l = list_is_empty(l); int x = rand() % n; l = list_push(l, x); x = f(x) % n; int xk; l = list_push(l, x); while(gcd(abs(x-f(x)), n) != 1) { xk = list_top(l); l = list_push(l, xk); l = list_tail(l); } return 0; } Loading Loading
tests/rho_pollard.c +16 −5 Changes for tests/rho_pollard.c: 16 added lines, 5 removed lines. Original line number Diff line number Diff line #include <stdarg.h> #include <stdio.h> #include <stdlib.h> #include <time.h> #include <math.h> #include "bignum.h" #include "list.h" Loading @@ -19,14 +21,23 @@ unsigned long int gcd(unsigned long int a, unsigned long int b){ return old_r; } unsigned long int f(x) { int f(x) { return x*x+1; } bignum_t has_cycle(list_t l) { int n = list_len(l); bignum_t x; int has_cycle(list_t l, int n) { srand(time(NULL)); l = list_is_empty(l); int x = rand() % n; l = list_push(l, x); x = f(x) % n; int xk; l = list_push(l, x); while(gcd(abs(x-f(x)), n) != 1) { xk = list_top(l); l = list_push(l, xk); l = list_tail(l); } return 0; } Loading