楼主看下我的测试分析代码,路子对不对?
[C++] 纯文本查看 复制代码 #define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include <windows.h>
#include <iomanip>
#include <string>
using namespace std;
void main()
{
char * yourName = new char[260];
long v16 = 0;
double v18 = 0;
double v17 = 0;
char * pEnd;
double v3 = strtol(yourName, &pEnd, 10);
double v4 = v3;
double v_tmp = 0;
int jump=0 ; //分步测试开关
//0-用户名测试,1-数字算术部分:";
if (!jump)
{
cout << "输入用户名:";
gets(yourName);
cout << endl;
goto test_string;
}
else
{
cout << "输入测试数字:";
cin >> v3;
}
while (1)
{
v4 = v18 - v3;
if (v18 - v3 < 0.0)
v4 = -v4;
if (v4 > 0.0000001)
v17 = v18 + 2.7182818284 / (v18 + 1.0) + 1.0;
if (v18 - 1000.0 > 0.0000001)
{
break;
cout << "通过了" << endl;
}
v_tmp = v3 + 2.7182818284 / (v3 + 1.0) + 1.0 - v17;
if (v_tmp > 0.0000001)
{
cout << "数字没有通过" << endl;
goto over;
}
v18 = v18 + 0.0001;
}
goto over;
test_string:
long length_s = strlen(yourName);
unsigned char * clist = new unsigned char[0x101];
cout << "ok" << endl;
//字符串顺序添充
for (int x = 0; x <= 0x100; x++)
clist[x] = x;
//生成第一次加密表
int c = 0;
for (int x = 0; x < 0x100; x++)
{
c += yourName[x % length_s];
c = (c + clist[x]) & 0xFF;
c &= 0xFF;
swap(clist[c], clist[x]);
}
//输出第一次加密表
cout << "输出第一次加密表" << endl;
for (int x = 0; x <= 0x100; x++)
cout << hex << uppercase <<(int) clist[x] << " ";
cout << endl;
//生成第二次加密表即窗口标题字节集
unsigned char list02[] = {0x8C, 0x6B, 0x43, 0x27, 0x10, 0x4A, 0xAA, 0x1E, 0x9C, 0xDA, 0xD1, 0x84, 0xF0, 0xA9, 0x00, 0x95};
int tmp = 0,tmp_2=0,tmp_ebp=0;
for (int x = 0; x < 0x10; x++)
{
tmp++;
tmp &= 0xFF;
tmp_2 = clist[tmp];
tmp_ebp+=tmp_2;
tmp_ebp &= 0xFF;
swap(clist[tmp], clist[tmp_ebp]);
list02[x] ^= clist[(clist[tmp] + clist[tmp_ebp]) & 0xFF];
}
double v5 = v3;
// cout << clist << endl;
//输出第二次加密表即窗口标题字节集
cout << "输出第二次加密表即窗口标题字节集" << endl;
for (int x = 0; x < 0x10; x++)
{
cout << hex << uppercase<<(int)list02[x] << " ";
}
cout << endl;
over:
system("pause");
} |