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

📄 euclid.cpp

📁 MFC下实现的仿射密码算法
💻 CPP
字号:
// Euclid.cpp: implementation of the Euclid class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "affine.h"
#include "Euclid.h"
#include <math.h>

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

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
Euclid::Euclid()
{
	
}

Euclid::~Euclid()
{

}
int Euclid::Backspin(int d)
{
	int Q;
	int t1,t2,t3;
	int x1=1,x2=0,x3=26;
	int y1=0,y2=1,y3=d;
	while (y3!=1&&y3!=0) {
		div_t div_quot;
	    div_quot=div(x3,y3);
		Q=div_quot.quot;
		t1=x1-Q*y1; t2=x2-Q*y2; t3=x3-Q*y3;
		x1=y1; x2=y2; x3=y3;
		y1=t1; y2=t2; y3=t3;
	}
	if (y3==0) { return D=0;}
	if (y3==1) {
		if (y2<0) {	y2=y2+26;}
		return D=y2;
	}    
 }

⌨️ 快捷键说明

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