天堂2数据包加密解密文档

类别:编程语言 点击:0 评论:0 推荐:
{***************************************************}
{                                                   }
{       天堂2数据包加密解密文档                       }
{                                                   }
{                                                   }
{       时间: 2004-2-19                             }
{                                                   }
{       编写者: nzinzi                              }
{                                                   }
{***************************************************}
{数据包加密代码system\Network.dll}
//----------------------------------------------------------------
// 登陆数据包 BlowFish
//----------------------------------------------------------------
//----------------------------------------------------------------
$10001000 BlowFish 加密函数 
//----------------------------------------------------------------
//----------------------------------------------------------------
$10001880 BlowFish 初始化函数 填充S盒P盒 KEY = '[;''.]94-31==-%&@!^+] '
//----------------------------------------------------------------
//----------------------------------------------------------------
$10006BD6 初始化游戏数据包KEY
//----------------------------------------------------------------
::10006BD6::  8890 D4490000            MOV [EAX+49D4],DL                       
::10006BDC::  8B4424 08                MOV EAX,[ESP+8]                         
::10006BE0::  8B4E 3C                  MOV ECX,[ESI+3C]                        
::10006BE3::  99                       CDQ                                     
::10006BE4::  8981 E0490000            MOV [ECX+49E0],EAX                      
::10006BEA::  81CA A16C5487            OR EDX,87546CA1                         
::10006BF0::  8991 E4490000            MOV [ECX+49E4],EDX                      
::10006BF6::  8B4424 08                MOV EAX,[ESP+8]                         
::10006BFA::  8B4E 3C                  MOV ECX,[ESI+3C]                        
::10006BFD::  99                       CDQ                                     
::10006BFE::  8981 D8490000            MOV [ECX+49D8],EAX                      
::10006C04::  81CA A16C5487            OR EDX,87546CA1                         
::10006C0A::  8991 DC490000            MOV [ECX+49DC],EDX 
//----------------------------------------------------------------
** ** ** ** A1 6C 54 87 ** ** ** ** A1 6C 54 87
|| || || || || || || || || || || || || || || ||
|| || || || || || || || || || || || +++++++++++---常量($87546CA1)
|| || || || || || || || +++++++++++---------------RECV长度累加值  初始值服务器返回
|| || || || +++++++++++---------------------------常量($87546CA1) 跟RECV一致
+++++++++++---------------------------------------SEND长度累加值
//----------------------------------------------------------------
$100023D0 游戏数据包加密SEND
//----------------------------------------------------------------
::100023D0::  8B5424 04                MOV EDX,[ESP+4]                         
::100023D4::  8A0A                     MOV CL,[EDX]                            
::100023D6::  56                       PUSH ESI                                
::100023D7::  8B7424 0C                MOV ESI,[ESP+C]                         
::100023DB::  8A06                     MOV AL,[ESI]                            
::100023DD::  32C8                     XOR CL,AL                               
::100023DF::  57                       PUSH EDI                                
::100023E0::  8B7C24 14                MOV EDI,[ESP+14]                        
::100023E4::  880A                     MOV [EDX],CL                            
::100023E6::  B9 01000000              MOV ECX,1                               
::100023EB::  3BF9                     CMP EDI,ECX                             
::100023ED::  7E 16                    JLE SHORT 10002405              \:JMPDOWN
::100023EF::  53                       PUSH EBX                                
::100023F0::  8A5C11 FF                MOV BL,[ECX+EDX-1]                      \:BYJMP JmpBy:10002402,
::100023F4::  8BC1                     MOV EAX,ECX                             
::100023F6::  83E0 07                  AND EAX,7                               
::100023F9::  321C30                   XOR BL,[EAX+ESI]                        
::100023FC::  301C11                   XOR [ECX+EDX],BL             
::100023FF::  41                       INC ECX                                 
::10002400::  3BCF                     CMP ECX,EDI                             
::10002402::  7C EC                    JL SHORT 100023F0                 \:JMPUP
::10002404::  5B                       POP EBX                                 
::10002405::  8B0E                     MOV ECX,[ESI]                           \:BYJMP JmpBy:100023ED,
::10002407::  8BC7                     MOV EAX,EDI                             
::10002409::  99                       CDQ                                     
::1000240A::  03C8                     ADD ECX,EAX                             
::1000240C::  8B46 04                  MOV EAX,[ESI+4]                         
::1000240F::  13C2                     ADC EAX,EDX                             
::10002411::  5F                       POP EDI                                 
::10002412::  890E                     MOV [ESI],ECX                           
::10002414::  8946 04                  MOV [ESI+4],EAX                         
::10002417::  5E                       POP ESI                                 
::10002418::  C2 0C00                  RETN C                                  
//----------------------------------------------------------------
$10002420 游戏数据包RECV解密
//----------------------------------------------------------------
::10002420::  55                       PUSH EBP                                
::10002421::  8B6C24 10                MOV EBP,[ESP+10]                        
::10002425::  56                       PUSH ESI                                
::10002426::  8B7424 0C                MOV ESI,[ESP+C]                         
::1000242A::  8A16                     MOV DL,[ESI]                            
::1000242C::  57                       PUSH EDI                                
::1000242D::  8B7C24 14                MOV EDI,[ESP+14]                        
::10002431::  8A07                     MOV AL,[EDI]                            
::10002433::  32C2                     XOR AL,DL                               
::10002435::  B9 01000000              MOV ECX,1                               
::1000243A::  3BE9                     CMP EBP,ECX                             
::1000243C::  8806                     MOV [ESI],AL                            
::1000243E::  7E 1B                    JLE SHORT 1000245B              \:JMPDOWN
::10002440::  53                       PUSH EBX                                
::10002441::  8A0431                   MOV AL,[ECX+ESI]                        \:BYJMP JmpBy:10002458,
::10002444::  8BD9                     MOV EBX,ECX                             
::10002446::  83E3 07                  AND EBX,7                               
::10002449::  8A1C3B                   MOV BL,[EBX+EDI]                        
::1000244C::  32D8                     XOR BL,AL                               
::1000244C::  32D8                     XOR BL,AL                               
::1000244E::  32DA                     XOR BL,DL                               
::10002450::  881C31                   MOV [ECX+ESI],BL                        
::10002453::  41                       INC ECX                                 
::10002454::  3BCD                     CMP ECX,EBP                             
::10002456::  8AD0                     MOV DL,AL                               
::10002458::  7C E7                    JL SHORT 10002441              \:JMPUP
::1000245A::  5B                       POP EBX                                 
::1000245B::  8B0F                     MOV ECX,[EDI]                           \:BYJMP JmpBy:1000243E,
::1000245D::  8BC5                     MOV EAX,EBP                             
::1000245F::  99                       CDQ                                     
::10002460::  03C8                     ADD ECX,EAX                             
::10002462::  8B47 04                  MOV EAX,[EDI+4]                         
::10002465::  13C2                     ADC EAX,EDX                             
::10002467::  890F                     MOV [EDI],ECX                           
::10002469::  8947 04                  MOV [EDI+4],EAX                         
::1000246C::  5F                       POP EDI                                 
::1000246D::  5E                       POP ESI                                 
::1000246E::  5D                       POP EBP                                 
::1000246F::  C2 0C00                  RETN C 

本文地址:http://com.8s8s.com/it/it23911.htm