Download code from here
I only did the decryption part, using Babai's algorithm (for homework :D)
I only did the decryption part, using Babai's algorithm (for homework :D)
I almost wish I hadn't gone down that rabbit-hole — and yet — and yet — it's rather curious, you know, this sort of life!
1105 is composite with witness 2 294409 is composite with witness 2 118901509 is prime 118901521 is composite with witness 2 118901527 is prime 118915387 is composite with witness 2
Points in E(F13) are : (-Infinity,-Infinity) (1.0,5.0) (1.0,8.0) (2.0,3.0) (2.0,10.0) (9.0,6.0) (9.0,7.0) (12.0,2.0) (12.0,11.0) Addition test-> (9.0,7.0) + (1.0,8.0) =(2.0,10.0) double-and-add algorithm for elliptic curve-> 947*(6.0,730.0) mod 3623= (3492.0,60.0)
Find prime factors of 48356747: 2^19! -1 = 13944673 (mod 48356747) gcd(2^19!-1,48356747) = 6917 factors of 48356747, p=6917, and q=48356747/6917=6991 The prime factorization of 6916 is: 2, 2, 7, 13, 19 The prime factorization of 6990 is: 2, 3, 5, 233
public class RSA { //find x from x^e = c (mod p) public static long findRoot(long e, long c, long p) { long x = 0; //find e^-1 (mod p-1) long eInverse = crypto.inverse(p-1, e); //x = c^d (mod p) x = crypto.fastSq(p, c, eInverse); return x; } //test: answer = 6059 public static void main(String[] args) { long e = 1583; long c = 4714; long p = 7919; long x = RSA.findRoot(e,c, p); System.out.println("Solution to x^"+e+" = "+c+" (mod "+p+"): x= "+x); } }
Solution to x^1583 = 4714 (mod 7919): x= 6059
Step:0->x=2+3*5=17 Step:1->x=17+21*7=164 Solution:164
[u,y,d] = gcd(x,p); y = mod(y,p);