⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.cpp

📁 C++ implementaion for RSA together with the Wiener attack. It uses NTL library for big numbers
💻 CPP
字号:
#include "RSACryptoSystem.h"
#include "Wiener.h"

#include <iostream>
#include <string>
#include <string>
#include <windows.h>
using namespace std;
void main()
{
	RSACryptoSystem r;
	try
	{
		RSACryptoSystem Alice("AlicePrvKey.txt","AlicePubKey.txt",512);
		RSACryptoSystem Bob("BobPrvKey.txt","BobPubKey.txt",640);



		NTL::ZZ x;
		NTL::ZZ y;
		NTL::ZZ z;
		x = 12345;
		Alice.Encode(x,y, Alice.GetPublicKey());
		Alice.Decode(y,z);
		cout << '\n' << x << '\n' <<z;
		return;
		x = NTL::RandomLen_ZZ(550);
		Alice.Encode(x, y, Bob.GetPublicKey());

		DWORD t1 = GetTickCount();
		Bob.Decode(y, z);
		DWORD t2 = GetTickCount();

		cout << x << "\n\n";
		cout << y << "\n\n";
		cout << z << "\n\n";

		cout << "decode time: " << t2 - t1 << '\n';

		Wiener Intruder;

		RSACryptoSystem Weak("BobPrvKey.txt","weak.txt",512);
		
		Intruder.Atack(Weak.GetPublicKey());
		Intruder.PrintAtackResults();
		Intruder.Atack(Bob.GetPublicKey());
		Intruder.PrintAtackResults();
	}
	catch(char s[100])
	{
		cout << s << '\n';
	}
	string s;
	
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -