| 首页 | 外挂资讯 | 外挂分类 | 最近更新 | 推荐外挂 | 热门外挂 | 免费外挂 | 破解外挂 | | 收费外挂 | 用户登陆 | ||||||
|
|
||
| 现在的传奇2加密解密
作者:不详 来源于:TTee.com 外挂网 发布时间:2005-3-13 4:29:22 |
| 普通字符串 解密: 密文字符串以4字节为一组,表示3个明文字符(中文算两个字符). 从第一字节开始,取密文的每字节的低6位加4,忽略进位, 然后连接成为位串,从头至尾每取8位,表示一个字节. 最后如果不足8位时,就停止,扔弃剩下的位. 加密: 将字符串按字节连成位串,从头至尾每次取6位.值加60,就成为一个加密字节, 最后不足6位时在后面以0补齐6位.即得到加密字符串 命令ID 解密: 命令ID以3字节表示一个16位整数. 取每字节低6位加4,忽略进位, 连接成为18位的位串,最后8位表示整数的高8位,从后往前第二个8位表示整数的低8位. 加密: 将整数低位字节在前,高位字节在后,连成16位长的位串,在前补两个0,补充18位. 从头至尾每6位取一次,加上60,成为一个加密字节.取完后成为3个字节长的加密的命令ID. Delphi代码 加密部分 function Encode(source : string):string; var Source_Len,Len : integer; Count,c : integer; a1,a2 : byte; ind : dword; Encode_Str : string; begin Result := ‘‘; Encode_Str := ‘‘; Len := 0; a1 := 0; a2 := 0; c := 0; ind := 0; Count := 0; Source_Len := Length(source); while Count < Source_Len do begin if Len >= $2710 then break; ind := ord(source[Count+1]); ind := ind shr (c+2); a1 := ind or a2; a1 := a1 and $3f; ind := ord(source[Count+1]); ind := ind shl (8-(c+2)); ind := ind shr 2; a2 := ind and $3f; inc(c,2); if c >= 6 then begin if Len >= $270f then begin Encode_Str := Encode_Str + chr(a1 + $3c); inc(Len); end else begin Encode_Str := Encode_Str + chr(a1 + $3c); Encode_Str := Encode_Str + chr(a2 + $3c); Inc(Len,2); end; c := 0; a2 := 0; end else begin Encode_Str := Encode_Str + chr(a1 + $3c); Inc(Len); end; inc(Count); end; if c > 0 then begin Encode_Str := Encode_Str + chr(a2 + $3c); Inc(Len); end; SetLength(Encode_Str,Len); Result := Encode_Str; end; 解密部分 function Decode(source : string):string; var Source_Len,Len : integer; Count,c1,c2 : integer; code : array[0..7] of byte; a1,a2 : byte; ind : dword; Decode_Str : string; label L1,L2; begin Result := ‘‘; Decode_Str := ‘‘; code[2] := $fc; code[4] := $f0; code[6] := $c0; Len := 0; a1 := 0; a2 := 0; c1 := 2; c2 := 0; ind := 0; Count := 0; Source_Len := Length(source); while (Count < Source_Len) do begin if(ord(Source[Count+1]) - $3c) < 0 then begin Decode_Str := Decode_Str + Source[Count+1]; inc(Len); inc(Count); a1 := 0; a2 := 0; c1 := 2; c2 := 0; ind := 0; Continue; //break; end; a1 := ord(Source[Count+1]) - $3c; if Len >= Source_Len then begin break; end; if (c2 + 6) < 8 then begin goto L2; end; ind := a1 and $3f; ind := ind shr (6-c1); Decode_Str := Decode_Str + chr(ind or a2); Inc(Len); c2 := 0; if c1 >= 6 then begin c1 := 2; goto L1; end; inc(c1,2); L2 :a2 := a1 shl c1; a2 := a2 and code[c1]; c2 := c2 + (8 - c1); L1 :inc(count); end; SetLength(Decode_Str,Len); Result := Decode_Str; end; |
|
[] [返回上一页] [告诉好友] [发表评论] [打 印] [ 字体:大 中 小 ] |
| 上篇文章:令Win32应用程序跳入系统零层 下篇文章:关于传奇2背包的数据格式 |
| ∷相关文章∷ |
| ∷相关软件∷ |
| 关于本站 - 下载声明 - 软件发布 - 下载帮助 - 广告联系 - 友情连接 - 用户注册 | @ 一切精彩外挂尽在TTee外挂网 @ |
| ttee.com 版权所有
Copyright © 2000-2007 TTee.com. All Rights Reserved.桂ICP备05001178号 |
|