-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrsacrack.old2.c
87 lines (69 loc) · 1.14 KB
/
rsacrack.old2.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#include <stdio.h>
#include <math.h>
typedef long long uintmax_t;
typedef double float_t;
uintmax_t euclid_calc_gcd(uintmax_t x,uintmax_t y)
{
uintmax_t temp;
for(;;)
{
if(x==y)
return x;
if(x<y)
{
temp=(y%x);
if(temp==0)
return(x);
else
y=temp;
}
else
{
temp=(x%y);
if(temp==0)
return(y);
else
x=temp;
}
}
}
#define MAX_XY 10
int main(int argc,char *argv[])
{
uintmax_t a,b,c,n,x1,x,y,i,j,gcd,y_minus_x;
uintmax_t poss_xy[MAX_XY];
if(argc!=3)
{
fprintf(stderr,"usage rsacrack p1 p2");
return -1;
}
a=atoll(argv[1]);
b=atoll(argv[2]);
c=a*b;
for(x1=1;x1<=1;x1++)
{
for(i=0;i<MAX_XY;i++)
{
y=poss_xy[i]=sqrt((i*i*c*c)+(2*i*x1*c)+(x1*x1));
printf("poss_xy %lld\n",y);
if(i>0)
{
for(j=0;j<i;j++)
{
x=poss_xy[j];
y_minus_x=y-x;
if((y_minus_x%c)!=0)
{
gcd=euclid_calc_gcd(c,y_minus_x);
if(gcd!=1&&gcd!=c)
{
if((c%gcd)==0)
printf("primes found %lld %lld",gcd,c/gcd);
}
}
}
}
}
}
printf("No primes found\n");
}