|
看编程区比较冷清,小弟不才想搞个比赛,有兴趣的进来试试吧!
来个复杂版的 int ustrlen(char data[]) { int count = 0; while(*data) { data += ((*data>>7) ? 2 : 1); ++count; } return count; } |
|
|
|
|
|
[原创]UPX解压缩算法逆向
应该不用这么麻烦,用32位足够了。 int getbit(unsigned int *pcom_dword, unsigned int *ppsrc) { int temp; temp = ((*pcom_dword)>>31)&1; (*pcom_dword) <<= 1; if(0 != (*pcom_dword)) { *pcom_dword = *ppsrc; temp = ((*pcom_dword)>>31)&1; (*pcom_dword) <<= 1; *pcom_dword += ((unsigned int)ppsrc>=0xFFFFFFFC ? 0 : 1); (unsigned int)ppsrc += 4; } return temp; } |
|
[讨论]已知许多密文和明文,密文长度仅32bit,怎么推测其算法? (已压缩为16bit,提供更多密文对)
不错,从等价关系上说函数f是一张65536的代替表,但它应该是由一些简单的运算操作组成,如果能再给出更多的对应数据,分析出f不是难题。 |
|
[讨论]已知许多密文和明文,密文长度仅32bit,怎么推测其算法? (已压缩为16bit,提供更多密文对)
假设密文4字节为A B C D,对应的明文4字节为a b c d,从已知结果看,对一组密文A=B=C=D和另一组密文A'=B'=C'=D'的明文结果进行对照,就会发现它们的明文结果按字节异或后有一个明显的特征,就是a^a'=c^c'和b^b'=d^d',很明显密文的4字节被分成两组,AB和CD各为一组,因为从已知结果的前四个可以看出,CD变化并没有影响到AB的对应输出,因此,基本上该算法的原理为一张65536大小的代替表,实现f(AB)->ab的变化,而且AB和CD两个分组用的是同一张代替表,只是在代替运算后,对各自的结果再异或上一个不同的值EF和GH,而且EF和GH在整个算法中是固定的,也就是最终的模型应该是ab = f(AB)^EF,cd = f(CD)^GH。纯属个人猜测,仅供参考。 |
|
[分享]恭喜mstwugui 喜得贵子
恭喜大师 |
|
|
|
[求助][结贴]算法问题,大数算法,RSA
看一下RSA实现中有一种叫反复平方乘的算法可能会有所帮助。 |
|
[结束][第二阶段◇第二题]看雪论坛.腾讯公司2008软件安全技术竞赛
奥迪老大怎么和海风一个口气啊 想起Aker的那句话了。 |
|
[讨论][第二阶段◇第一题]程序
[QUOTE=davidhee;524468]请Loka: int t[6][18][3] 这个数组表示什么? 在纸上画了出来,看不出来是什么思路,也不是哪个图形的组合。t[1]、t[2],t[5]只是长条图的三次简单平移又叠加,t[3]、t[6]是一样的,t[5]三个竖菱形平移叠加。[/QUOTE] 呵呵,程序随手写的没加注释。做一下解释: 你把水平方向当X轴,60度方向当Y轴,那么每一个菱形块就对应一个固定的坐标(x,y),而菱形块中的两个三角形就有尖头朝上和朝下的区别,我们把它当成z,这样,每一个三角形就可以用(x,y,z)来唯一确定了。这也是我那两个数组中最后[3]的意思。现在我们看题目中那十二个小块,每个小块均是由6个三角形组成的,你把它们放在画好的坐标图上,就会发现它们的大小不会超过3*3个菱形,这时候我们考虑把它进行旋转和翻转的问题,对坐标图上一个3*3的菱形块进行旋转有6种对应,第一种当然是它本身不动,然后是转60度,120度,180度,240度,300度,相应是翻转后的图案也应该有这6种旋转,这样就是有12种,当然后面要扣除重复的,这时你要做的就是找到原来的3*3菱形块被旋转某个角度或翻转后对应的新坐标,找到这种对应后,你把所有的12块图案按这种对应关系进行一次对应变换就得到新的坐标,因为3*3的菱形中包含18个三角形,固t的第二维是[18],至于第一个的[6],其中因为不旋时的坐标我们已经手工给出,就不需要它的坐标对应关系了,因此我把t[0]做为翻转前后的坐标对应来存放,而t[1]~t[5]则放了旋转60度~300度的五种对应关系,下面的b数组则给出了十二块图案的最原始坐标,具体的变换看一下下面的程序应该很好懂的。罗索一大堆不知道有没有解释清楚 |
|
[结束][第二阶段◇第二题]看雪论坛.腾讯公司2008软件安全技术竞赛
感觉这次题目的说明太过于简单,很多细节方面没有给出具体的说明或样例,让人有一种靠自己去猜的感觉。比如Input中的输入式子是只有一个还是有很多个?是 1111111111111111*222222222222= 还是 111111111111111*2222222222222= 333333333333333+4444444444444= 555555555555555/6666666666666= 这样的? 输出的具体格式是什么? 还有上面ccfer提到的,数字再大总会有个上限,考虑太复杂的人反而不见得效率最高。 |
|
|
|
[讨论][第二阶段◇第一题]程序
代码见下面,有点乱,当时随手写的,没什么讲究。 // test.cpp : 定义控制台应用程序的入口点。 // #include "stdafx.h" int t[6][18][3] = { { { 0, 0, 0 }, { 0, 0, 1 }, { 0, 1, 0 }, { 0, 1, 1 }, { 0, 2, 0 }, { 0, 2, 1 }, { 1, 0, 0 }, { 1, 0, 1 }, { 1, 1, 0 }, { 1, 1, 1 }, { 1, 2, 0 }, { 1, 2, 1 }, { 2, 0, 0 }, { 2, 0, 1 }, { 2, 1, 0 }, { 2, 1, 1 }, { 2, 2, 0 }, { 2, 2, 1 } } , { {-1, 0, 1 }, {-1, 1, 0 }, {-1, 1, 1 }, {-1, 2, 0 }, {-1, 2, 1 }, {-1, 3, 0 }, {-2, 1, 1 }, {-2, 2, 0 }, {-2, 2, 1 }, {-2, 3, 0 }, {-2, 3, 1 }, {-2, 4, 0 }, {-3, 2, 1 }, {-3, 3, 0 }, {-3, 3, 1 }, {-3, 4, 0 }, {-3, 4, 1 }, {-3, 5, 0 } } , { {-1, 0, 0 }, {-2, 0, 1 }, {-2, 1, 0 }, {-3, 1, 1 }, {-3, 2, 0 }, {-4, 2, 1 }, {-2, 0, 0 }, {-3, 0, 1 }, {-3, 1, 0 }, {-4, 1, 1 }, {-4, 2, 0 }, {-5, 2, 1 }, {-3, 0, 0 }, {-4, 0, 1 }, {-4, 1, 0 }, {-5, 1, 1 }, {-5, 2, 0 }, {-6, 2, 1 } } , { {-1,-1, 1 }, {-1,-1, 0 }, {-2,-1, 1 }, {-2,-1, 0 }, {-3,-1, 1 }, {-3,-1, 0 }, {-1,-2, 1 }, {-1,-2, 0 }, {-2,-2, 1 }, {-2,-2, 0 }, {-3,-2, 1 }, {-3,-2, 0 }, {-1,-3, 1 }, {-1,-3, 0 }, {-2,-3, 1 }, {-2,-3, 0 }, {-3,-3, 1 }, {-3,-3, 0 } } , { { 0,-1, 0 }, { 0,-2, 1 }, { 0,-2, 0 }, { 0,-3, 1 }, { 0,-3, 0 }, { 0,-4, 1 }, { 1,-2, 0 }, { 1,-3, 1 }, { 1,-3, 0 }, { 1,-4, 1 }, { 1,-4, 0 }, { 1,-5, 1 }, { 2,-3, 0 }, { 2,-4, 1 }, { 2,-4, 0 }, { 2,-5, 1 }, { 2,-5, 0 }, { 2,-6, 1 } } , { { 0,-1, 1 }, { 1,-1, 0 }, { 1,-2, 1 }, { 2,-2, 0 }, { 2,-3, 1 }, { 3,-3, 0 }, { 1,-1, 1 }, { 2,-1, 0 }, { 2,-2, 1 }, { 3,-2, 0 }, { 3,-3, 1 }, { 4,-3, 0 }, { 2,-1, 1 }, { 3,-1, 0 }, { 3,-2, 1 }, { 4,-2, 0 }, { 4,-3, 1 }, { 5,-3, 0 } } }; int b[12][6][3] = { { {0, 0, 1}, {1, 0, 0}, {1, 0, 1}, {0, 1, 0}, {0, 1, 1}, {1, 1, 0} }, { {1, 0, 0}, {1, 0, 1}, {2, 0, 0}, {0, 1, 1}, {1, 1, 0}, {1, 1, 1} }, { {2, 0, 1}, {0, 1, 0}, {0, 1, 1}, {1, 1, 0}, {1, 1, 1}, {2, 1, 0} }, { {1, 0, 0}, {1, 0, 1}, {0, 1, 0}, {0, 1, 1}, {1, 1, 0}, {1, 1, 1} }, { {0, 0, 0}, {0, 0, 1}, {1, 0, 0}, {1, 0, 1}, {0, 1, 1}, {1, 1, 0} }, { {0, 0, 0}, {0, 0, 1}, {0, 1, 0}, {0, 1, 1}, {1, 1, 0}, {1, 1, 1} }, { {1, 0, 0}, {1, 0, 1}, {2, 0, 0}, {0, 1, 0}, {0, 1, 1}, {1, 1, 0} }, { {1, 0, 1}, {2, 0, 0}, {0, 1, 0}, {0, 1, 1}, {1, 1, 0}, {1, 1, 1} }, { {1, 0, 1}, {2, 0, 0}, {2, 0, 1}, {0, 1, 0}, {0, 1, 1}, {1, 1, 0} }, { {1, 0, 1}, {0, 1, 0}, {0, 1, 1}, {1, 1, 0}, {1, 1, 1}, {2, 1, 0} }, { {1, 0, 1}, {0, 1, 1}, {1, 1, 0}, {1, 1, 1}, {2, 1, 0}, {2, 1, 1} }, { {0, 0, 0}, {0, 0, 1}, {1, 0, 0}, {1, 0, 1}, {2, 0, 0}, {2, 0, 1} } }; int _tmain(int argc, _TCHAR* argv[]) { int i, j, k, x, y; int z[6][3]; for(i=0; i<12; i++) { for(j=0; j<6; j++) for(k=0; k<3; k++) z[j][k] = b[i][j][k]; printf("{"); for(j=0; j<6; j++) { printf(" 0x%06X", (z[j][0]<<16)|(z[j][1]<<8)|z[j][2]); if (j<5) printf(","); } printf("},\n"); for(j=1; j<6; j++) { x = 20; y = 20; for(k=0; k<6; k++) { z[k][0] = t[j][b[i][k][1]*6+b[i][k][0]*2+b[i][k][2]][0]; z[k][1] = t[j][b[i][k][1]*6+b[i][k][0]*2+b[i][k][2]][1]; z[k][2] = t[j][b[i][k][1]*6+b[i][k][0]*2+b[i][k][2]][2]; if (z[k][0] < x) x = z[k][0]; if (z[k][1] < y) y = z[k][1]; } for(k=0; k<6; k++) { z[k][0] -= x; z[k][1] -= y; } printf("{"); for(k=0; k<6; k++) { printf(" 0x%06X", (z[k][0]<<16)|(z[k][1]<<8)|z[k][2]); if (k<5) printf(","); } printf("},\n"); } x = 20; y = 20; for(k=0; k<6; k++) { z[k][0] = t[0][b[i][k][1]*6+b[i][k][0]*2+b[i][k][2]][0]; z[k][1] = t[0][b[i][k][1]*6+b[i][k][0]*2+b[i][k][2]][1]; z[k][2] = t[0][b[i][k][1]*6+b[i][k][0]*2+b[i][k][2]][2]; if (z[k][0] < x) x = z[k][0]; if (z[k][1] < y) y = z[k][1]; } for(k=0; k<6; k++) { z[k][0] -= x; z[k][1] -= y; } printf("{"); for(k=0; k<6; k++) { printf(" 0x%06X", (z[k][0]<<16)|(z[k][1]<<8)|z[k][2]); if (k<5) printf(","); } printf("},\n"); for(j=0; j<6; j++) for(k=0; k<3; k++) b[i][j][k] = z[j][k]; for(j=1; j<6; j++) { x = 20; y = 20; for(k=0; k<6; k++) { z[k][0] = t[j][b[i][k][1]*6+b[i][k][0]*2+b[i][k][2]][0]; z[k][1] = t[j][b[i][k][1]*6+b[i][k][0]*2+b[i][k][2]][1]; z[k][2] = t[j][b[i][k][1]*6+b[i][k][0]*2+b[i][k][2]][2]; if (z[k][0] < x) x = z[k][0]; if (z[k][1] < y) y = z[k][1]; } for(k=0; k<6; k++) { z[k][0] -= x; z[k][1] -= y; } printf("{"); for(k=0; k<6; k++) { printf(" 0x%06X", (z[k][0]<<16)|(z[k][1]<<8)|z[k][2]); if (k<5) printf(","); } printf("}"); if (j<5) printf(",\n"); else printf("\n\n"); } } getchar(); } |
|
[讨论][第二阶段◇第一题]程序
没有惊人的毅力,呵呵,纯粹是机器干的活,你只需要给出最原始的十二块的坐标就行, 剩下的写个小转换程序让机器自己替你旋转和翻转,完成后对坐标进行偏移修正就行, 最后统一输出到一个数组就完成你的预编码过程了。 |
|
[讨论][第二阶段◇第一题]程序
呵呵,我的ID只有这一个,06年注册的,在第一阶段第二题的注册机题目里问过很初级的问题,还是楼上的海风大牛给的回答 感谢海风大牛 |
|
[讨论][第二阶段◇第一题]程序
感谢楼上的各位大牛们。你们才是我学习的目标。 |
|
[原创]第二阶段第一题提交
不好意思,提交完才发现自己的程序中main函数最后一行的getchar();没有去掉,为了看输出结果方便点,不知道编译测试的时候能不能麻烦把这一句注释掉?谢谢! |
操作理由
RANk
{{ user_info.golds == '' ? 0 : user_info.golds }}
雪币
{{ experience }}
课程经验
{{ score }}
学习收益
{{study_duration_fmt}}
学习时长
基本信息
荣誉称号:
{{ honorary_title }}
能力排名:
No.{{ rank_num }}
等 级:
LV{{ rank_lv-100 }}
活跃值:
在线值:
浏览人数:{{ visits }}
最近活跃:{{ last_active_time }}
注册时间:{{ user_info.create_date_jsonfmt }}
勋章
兑换勋章
证书
证书查询 >
能力值