diff options
Diffstat (limited to 'main.cpp')
-rw-r--r-- | main.cpp | 31 |
1 files changed, 27 insertions, 4 deletions
@@ -6,9 +6,11 @@ #include <cctype> #include <ctime> #include <cassert> +#include "base64.h" #include "bigint.h" #include "numalgo.h" #include "primes.h" +#include "rng.h" #include "rsa.h" using namespace std; @@ -128,7 +130,7 @@ void testisqrt(int argc,char **argv){ } void performrsa(){ - PrivateKey privkey; + RSA::PrivateKey privkey; Bigint p(1000000007),q(3000000019U); privkey.pub.mod=3000000040000000133LL; privkey.pub.exp=65537; @@ -139,9 +141,9 @@ void performrsa(){ cout<<"d = "<<privkey.pexp<<endl; Bigint msg(123456789); cout<<"msg = "<<msg<<endl; - Bigint encr=encrypt(privkey.pub,msg); + Bigint encr=RSA::encrypt(privkey.pub,msg); cout<<"encr = "<<encr<<endl; - Bigint msg2=decrypt(privkey,encr); + Bigint msg2=RSA::decrypt(privkey,encr); cout<<"msg = "<<msg2<<endl; } @@ -195,5 +197,26 @@ int main(int argc,char **argv){ // cout<<strongLucasPrime(Bigint(5777))<<endl; // pseudolist(strongPseudoPrime2); // pseudolist(strongLucasPrime); - listprimes(); + // listprimes(); + + // Rng rng("wachtwoord"); + // for(int i=0;i<100000;i++)cout<<rng.get()<<endl; + + // for(int i=0;i<10000;i++)cout<<arc4random()<<endl; + + /*KeyRng rng("wachtwoord"); //for DieHarder + char data[4]; + for(int i=0;i<10000000;i++){ + *(uint32_t*)data=rng.get(); + fwrite(data,1,4,stdout); + }*/ + + string s; + while(true){ + char c=cin.get(); + if(!cin)break; + s.push_back(c); + } + cout<<Base64::encode(s)<<endl; + // cout<<Base64::decode(s)<<flush; } |