From d24ab714b958b9fece4631076e240739ad0dd23f Mon Sep 17 00:00:00 2001 From: tomsmeding Date: Mon, 3 Oct 2016 22:15:25 +0200 Subject: Progress --- main.cpp | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) (limited to 'main.cpp') diff --git a/main.cpp b/main.cpp index ce1573f..2d652b4 100644 --- a/main.cpp +++ b/main.cpp @@ -8,6 +8,7 @@ #include #include "bigint.h" #include "numalgo.h" +#include "primes.h" #include "rsa.h" using namespace std; @@ -108,6 +109,23 @@ void repl(int argc,char **argv){ } } +void testisqrt(int argc,char **argv){ + int randsize=argc==2?strtol(argv[1],nullptr,10):1; + assert(randsize>=1); + for(int i=0;i<1000;i++){ + Bigint n(rand64()); + for(int j=1;jn); + } +} + void performrsa(){ PrivateKey privkey; Bigint p(1000000007),q(3000000019); @@ -115,8 +133,7 @@ void performrsa(){ privkey.pub.exp=65537; { Bigint x; - Bigint one(1); - egcd((p-one)*(q-one),privkey.pub.exp,x,privkey.pexp); + egcd((p-Bigint::one)*(q-Bigint::one),privkey.pub.exp,x,privkey.pexp); } cout<<"d = "<