如何将接收到的数据包(WPE)的字符还原成汉字。
小弟刚学delphi 也刚了解包,学做传奇外挂。
以上问题是,传奇中聊天时的数据包,但不知道如何转换成汉字。
小弟刚学delphi 也刚了解包,学做传奇外挂。
以上问题是,传奇中聊天时的数据包,但不知道如何转换成汉字。
解决方案 »
- VC的源码!帮忙翻译成delphi,很简单的几句!
- 如何将ie收葳夹里的内容填充到一ListBox(ListView)中,并能点击处理?
- 如果进行组合索引(排序)
- min()的用法。
- 关于GRID控件的问题
- Delphi 中FORM的设计问题
- 求指导
- 感谢大家。。。我发出去请修改的代码有回音了,送分3天。。(遗憾的是没有修改完,如果你能帮我----见内)。。。up 有分
- 高手们指点:怎样成为delphi高手,是否必须先成为VC高手!
- 问个问题 :)
- 同时打开两个adodataset就出现“多步操作产生错误,请检查每一步状态的值”----急!!!
- 时间相加后,如何判断相加后的这个时间是今天的还是明天的!!
加密部分
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;