📄 keyset.cpp
字号:
// KeySet.cpp: implementation of the CKeySet class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "PWKeyEncrypt.h"
#include "KeySet.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CKeySet::CKeySet()
{
}
CKeySet::~CKeySet()
{
}
BOOL CKeySet::Encrypt()
{
int nPrev = 0;
//
// Copy the KEY_SET_VECTOR to the encrypted data without
// any encryption.
//
memcpy(EncryptedData, RawData, VECTOR_SIZE);
for (int nByte = 0; nByte < KEYSET_SIZE; nByte ++)
{
EncryptedData[VECTOR_SIZE+nByte] = RawData[VECTOR_SIZE+nByte] ^ nPrev;
nPrev = RawData[VECTOR_SIZE+nByte];
//#define SHOW_ENCRYPTION
#ifdef SHOW_ENCRYPTION
CString strDebug;
strDebug.Format("Encode in: 0x%02X out: 0x%02X\n", nPrev, EncryptedData[nByte]);
OutputDebugString(strDebug);
#endif
}
return TRUE;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -