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

📄 crypt.cpp

📁 1.MyIE开源工程协议 MyIE开源工程遵循GNU通用公共许可证GPL(GNU General Public License)开发,任何人都可以永久免费安装使用,在你下载和使用MyIE源代码前,请
💻 CPP
字号:
// Crypt.cpp: implementation of the CCrypt class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "MyIE.h"
#include "Crypt.h"

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

//#pragma optimize( "s", on)

char InnKey1[9]="7eOp@m0D";
char InnKey2[9]="4#76fBU&";

void EncodingByKey(LPCSTR src, CString& dest,char InnKey[9])
{
	int l=0;
	char tmp;
	BYTE t, t2;
	dest.Empty();
	for(UINT i = 0; i<strlen(src); i++)
	{
		t = src[i] ^ InnKey[l];
		t2 = t & 0xF;
		t = t >> 4;
		tmp = 'A' + t;
		dest += tmp;
		tmp = 'A' + t2;
		dest += tmp;

		l++;
		l=l%8;
	}
}

void DecodingByKey(LPCSTR src, CString& dest,char InnKey[9])
{
	int l=0, v;
	BYTE t,	c=0;
	dest.Empty();
	for(UINT i=0; i<strlen(src); i++)
	{
		t=src[i];
		if(t>='A' && t<='Q')
			v = t-'A';
		else
			v = 0;
	
		c = c << 4;
		c |= v;
		if(i%2==1)
		{
			c = c ^ InnKey[l];
			dest += (char)c;
			c=0;
			l++;
			l = l%8;
		}
	}
}

void Encoding(LPCSTR src, CString& dest)
{
	EncodingByKey(src,dest,InnKey1);
}
void Decoding(LPCSTR src, CString& dest)
{
	DecodingByKey(src,dest,InnKey1);
}
void Encoding2(LPCSTR src, CString& dest)
{
	EncodingByKey(src,dest,InnKey2);
}
void Decoding2(LPCSTR src, CString& dest)
{
	DecodingByKey(src,dest,InnKey2);
}
//#pragma optimize( "s", off)

⌨️ 快捷键说明

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