- UID
- 32691
注册时间2007-8-2
阅读权限20
最后登录1970-1-1
以武会友
 
TA的每日心情 | 开心 2019-2-6 23:35 |
---|
签到天数: 1 天 [LV.1]初来乍到
|
发表于 2009-3-30 18:17:13
|
显示全部楼层
学习了,新版本改了一点,但是算法还是一样的
C++代码如下
#include <iostream>
#include <cstring>
using namespace std;
int main()
{
char mcode[20];
cout << "Enter mcode: ";
cin >> mcode;
int ecx, edx;
long ebx;
long key1 = 0;
for(ecx = 1, edx = strlen(mcode); edx > 0; --edx, ++ecx){
ebx = mcode[ecx - 1];
ebx = ebx * 0x55939;
key1 += ebx;
key1 += 0x69316;
}
long key2 = 0;
for(ecx = 1, edx = strlen(mcode); edx > 0; --edx, ++ecx){
ebx = mcode[ecx - 1];
ebx = ebx * 0x0C8649;
key2 += ebx;
key2 += 0x69316;
}
cout << "key1: " << key1 << endl
<< "key2: " << key2 << endl;
return 0;
} |
|