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

📄 rsa.cpp

📁 rsa算法/// ////
💻 CPP
字号:
// 测试代码
//

#include "LargeInt.h"
#include <iostream>
using namespace std;
using namespace panic;

int main(int argc, char* argv[])
{
	
	CLargeInt p,q,n,d,e,m,c;
	cout << "Create Random P,Q,E,M" << endl;
	CLargeInt::CreateRandom(p,2048);
	CLargeInt::CreateRandom(q,2048);
	CLargeInt::CreateRandom(e,128);
	CLargeInt::CreateRandom(m,64);
	p.Print();
	q.Print();
	e.Print();
	m.Print();

	cout << "Create Prime P,Q,E" << endl;
	CLargeInt::CreatePrime(p);
	CLargeInt::CreatePrime(q);
	CLargeInt::CreatePrime(e);

	p.Print();
	q.Print();
	e.Print();

	cout << "Create D,N" << endl;
	CLargeInt::RSACreate(p,q,e,d,n);
	d.Print();
	n.Print();

	cout << "Encode M->C" << endl;
	CLargeInt::RSAEncode(n,d,m,c);
	c.Print();
	
	cout << "Decode C->M" << endl;
	CLargeInt::RSADecode(n,e,c,m);
	m.Print();
	return 0;
}

⌨️ 快捷键说明

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