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

📄 rrypt.cpp

📁 偶作的毕业设计程序
💻 CPP
字号:
// Rrypt.cpp: implementation of the CRrypt class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "SoftDocSystem.h"
#include "Rrypt.h"

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
#define C1 52845;
#define C2 23786;
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////


CString CCrypt::Encrypt (CString S,WORD Key)
{
	CString Result,str;
	int i,j;
	Result=S;
	for(i=0;i<S.GetLength ();i++){
		Result.SetAt (i,S.GetAt (i)^(Key>>8));
		Key=((BYTE)Result.GetAt (i)+Key)*C1+C2;}
	S=Result;
	Result.Empty ();
	for(i=0;i<S.GetLength ();i++)
	{j=(BYTE)S.GetAt(i);
	str="12";
	str.SetAt (0,65+j/26);
	str.SetAt (1,65+j%26);
	Result+=str;}
	return Result;
}
CString CCrypt::Decrypt (CString S,WORD Key)
{
CString Result,str;
int i,j;
Result.Empty ();
for(i=0;i<S.GetLength ()/2;i++)
{j=(((BYTE)S.GetAt (2*i)-65))*26;
j=j+BYTE(S.GetAt (2*i+1));
str="1";
str.SetAt (0,j);
Result+=str;}
S=Result;
for(i=0;i<S.GetLength ();i++)
{
Result.SetAt(i,(BYTE)S.GetAt (i)^(Key>>8));
Key=((BYTE)S.GetAt(i)+Key)*C1+C2;}
return Result;
}

⌨️ 快捷键说明

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