//原理: a异或b异或b 等于 a
//b就是密码
# include
int __stdcall wWinMain( __in HINSTANCE hInstance, __in_opt HINSTANCE hPrevInstance, __in_opt LPWSTR lpCmdLine, __in int nShowCmd )
{
int numInput[4] = {1, 2, 3, 4}; //输入数据
int key[4] = {6, 2, 9, 8}; //密码
int enp[4], disenp[4]; //加密与解密后的数据
for(int i = 0; i < 4; ++i)
{
enp[i] = numInput[i] ^ key[i];
disenp[i] = enp[i] ^ key[i];
}
wchar_t strDsp[56];
wsprintf(strDsp, L"原数据%d:%d:%d:%d", numInput[0], numInput[1], numInput[2], numInput[3]);
::MessageBox(::GetForegroundWindow(), strDsp, strDsp, 0);
wsprintf(strDsp, L"加密后%d:%d:%d:%d", enp[0], enp[1], enp[2], enp[3]);
::MessageBox(::GetForegroundWindow(), strDsp, strDsp, 0);
wsprintf(strDsp, L"解密后%d:%d:%d:%d", disenp[0], disenp[1], disenp[2], disenp[3]);
::MessageBox(::GetForegroundWindow(), strDsp, strDsp, 0);
return 0;
}