某棋牌游戏加密解密

朋友叫我帮个忙分析一款棋牌游戏通信协议以为有难度,分析了半小时搞定既然如此简单,游戏公司赶紧改算法吧不然脱机都出来了。
加密
00410860    53              push    ebx
00410861    8B5C24 08       mov     ebx, dword ptr [esp+8]
00410865    56              push    esi
00410866    57              push    edi
00410867    8BCB            mov     ecx, ebx
00410869    FF15 DC7A4D00   call    dword ptr [<&MSVCP71.std::basic_string; 

MSVCP71.std::basic_string,std::allocator >::data
0041086F    8BCB            mov     ecx, ebx
00410871    8BF8            mov     edi, eax
00410873    BE 02000000     mov     esi, 2
00410878    FF15 7C7B4D00   call    dword ptr [<&MSVCP71.std::basic_string; 

MSVCP71.std::basic_string,std::allocator >::size
0041087E    3BC6            cmp     eax, esi
00410880    76 20           jbe     short 004108A2
00410882    8A043E          mov     al, byte ptr [esi+edi]
00410885    8AC8            mov     cl, al
00410887    C0E9 04         shr     cl, 4
0041088A    C0E0 04         shl     al, 4
0041088D    0AC8            or      cl, al
0041088F    80F1 36         xor     cl, 36
00410892    880C3E          mov     byte ptr [esi+edi], cl
00410895    8BCB            mov     ecx, ebx
00410897    46              inc     esi
00410898    FF15 7C7B4D00   call    dword ptr [<&MSVCP71.std::basic_string; 

MSVCP71.std::basic_string,std::allocator >::size
0041089E    3BF0            cmp     esi, eax
004108A0  ^ 72 E0           jb      short 00410882
004108A2    5F              pop     edi
004108A3    5E              pop     esi
004108A4    5B              pop     ebx
004108A5    C3              retn

解密
00414830      57                 push    edi
00414831      8B7C24 0C          mov     edi, dword ptr [esp+C]
00414835      33C9               xor     ecx, ecx
00414837      85FF               test    edi, edi
00414839      7E 1D              jle     short 00414858
0041483B      56                 push    esi
0041483C      8B7424 0C          mov     esi, dword ptr [esp+C]
00414840      8A0431             mov     al, byte ptr [ecx+esi]
00414843      34 36              xor     al, 36
00414845      8AD0               mov     dl, al
00414847      C0EA 04            shr     dl, 4
0041484A      C0E0 04            shl     al, 4
0041484D      0AD0               or      dl, al
0041484F      881431             mov     byte ptr [ecx+esi], dl
00414852      41                 inc     ecx
00414853      3BCF               cmp     ecx, edi
00414855    ^ 7C E9              jl      short 00414840
00414857      5E                 pop     esi
00414858      5F                 pop     edi
00414859      C3                 retn


你可能感兴趣的:(汇编,数据分析)