sm_rsa.cpp

来自「椭圆曲线密码C实现的」· C++ 代码 · 共 67 行

CPP
67
字号
// SM_RSA.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include "rsa.h"
//#include "DBlock.h"
#include "conio.h"
int main(int argc, char* argv[])
{
	vlong out1,out2,out3,out4,out5,out6,out7;
	clock_t start,end;	
	int o,oo;
/*
	out1 = 12412349;
	out4 = out1;
	out5 = vlong(100000);
	start = clock();
	::modexp(out4,198001,100000,out3);
	o = out3;
	end = clock() - start; 	
	printf("end1: %d\n",end);

	start = clock();
	for(int i = 0;i<198000;i++)
	{
		out1 = out1*vlong(12412349);
		out1 = out1%out5;
//		if(out1>out5)
//			;
//		out1 = out5;
//		out1/out5;
//		vlong xx;
	}
	end = clock() - start;
	printf("end2: %d\n",end);
	oo = out1;
	getch();

	out4 = out1;
*/
//	cout << dump\n";


//	::findprime(out,60*8);
//	::randval(out,1000);
/*
	CDBlock theBlk(2539);
	unsigned  char str[] = "public key encryptions";
	theBlk.MToDigist(str,sizeof(str));
*/

	vlong	p,q,d,n,e;
	vlong	plain,cipher;
	private_key	thePrvtKey;
	thePrvtKey.create();

	plain = 'H';
	cipher = thePrvtKey.encrypt(plain);
	plain = thePrvtKey.decrypt(cipher);
	char  c = plain;
	
	printf("Hello World! %c\n",c);
	getch();
	return 0;
}

 

⌨️ 快捷键说明

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