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

📄 rsadoc.cpp

📁 一个关于密码算法RSA的实现程序
💻 CPP
字号:
// RSADoc.cpp : implementation of the CRSADoc class
//

#include "stdafx.h"
#include "RSA.h"

#include "RSADoc.h"
#include "inverse.h"
#include "GCD.h"
#include "Computmod.h"
#include "afxwin.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CRSADoc

IMPLEMENT_DYNCREATE(CRSADoc, CDocument)

BEGIN_MESSAGE_MAP(CRSADoc, CDocument)
	//{{AFX_MSG_MAP(CRSADoc)
	ON_COMMAND(ID_COMPUTE_INVERSE, OnComputeInverse)
	ON_COMMAND(ID_MODULE, OnModule)
	ON_COMMAND(ID_GCD, OnGcd)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CRSADoc construction/destruction

CRSADoc::CRSADoc()
{
	// TODO: add one-time construction code here
//	hWnd=NULL;
	
//	hdc=GetDC(hWnd);
}

CRSADoc::~CRSADoc()
{
}

BOOL CRSADoc::OnNewDocument()
{
	if (!CDocument::OnNewDocument())
		return FALSE;

	// TODO: add reinitialization code here
	// (SDI documents will reuse this document)

	return TRUE;
}



/////////////////////////////////////////////////////////////////////////////
// CRSADoc serialization

void CRSADoc::Serialize(CArchive& ar)
{
	if (ar.IsStoring())
	{
		// TODO: add storing code here
	}
	else
	{
		// TODO: add loading code here
	}
}

/////////////////////////////////////////////////////////////////////////////
// CRSADoc diagnostics


/////////////////////////////////////////////////////////////////////////////
// CRSADoc commands

void CRSADoc::OnComputeInverse() 
{
	// TODO: Add your command handler code here
	int Inv;
	Inv=ExtendEuclid(81,4576);
	if(Inv<=0)
	{
		Inv=Inv+4576;
	}
	char temp[500];
	sprintf(temp,"模逆元%d",Inv);
	MessageBox(NULL,temp,"模逆元",MB_OK);
}

#ifdef _DEBUG
void CRSADoc::AssertValid() const
{
	CDocument::AssertValid();
}

void CRSADoc::Dump(CDumpContext& dc) const
{
	CDocument::Dump(dc);
}
#endif //_DEBUG

void CRSADoc::OnModule() 
{
	// TODO: Add your command handler code here
	unsigned long Resu;
	Resu=Module(440, 113, 4717);
    char temp[500];
	sprintf(temp,"幂模%d",Resu);
	MessageBox(NULL,temp,"幂模",MB_OK);


	
}

void CRSADoc::OnGcd() 
{
	// TODO: Add your command handler code here
	int Gcd;
	Gcd=computgcd(4576,81);
	char temp[500];
	sprintf(temp,"最大公约数%d",Gcd);
	MessageBox(NULL,temp,"最大公约数",MB_OK);


	
}

⌨️ 快捷键说明

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