glukmaker,
http://l2ph.coderx.ru/wsvn/filedetai...%2Fuencdec.pas
тебя там интересуют L2Xor.DecryptGP, L2Xor.EncryptGP и L2Xor.InitKey
в методе L2Xor.InitKey параметр Interlude для твоего сервера будет равен 0
Добавлено через 2 минуты
а хотя вот более оптимальный вариант:
delphi Код:
unit CryptXOR;
interface
type
TxorCrypt = object
public
GKeyS,GKeyR:array[0..15] of Byte;
isInit: Boolean;
keyLen: integer;
procedure InitKey(const XorKey; Interlude: Boolean = False);
procedure DecryptGP(var Data; const Size: Word);
procedure EncryptGP(var Data; const Size: Word);
end;
implementation
procedure TxorCrypt.DecryptGP(var Data; const Size: Word);
var
k:integer;
pck:array[0..0] of Byte absolute Data;
begin
if not isInit then Exit;
for k:=size-1 downto 1 do
pck[k]:=pck[k] xor GKeyR[k and keyLen] xor pck[k-1];
if size<>0 then pck[0]:=pck[0] xor GKeyR[0];
Inc(PCardinal(@GKeyR[keyLen-7])^,size);
end;
procedure TxorCrypt.EncryptGP(var Data; const Size: Word);
var
i:integer;
pck:array[0..0] of Byte absolute Data;
begin
if not isInit then Exit;
if size<>0 then pck[0]:=pck[0] xor GKeyS[0];
for i:=1 to size-1 do
pck[i]:=pck[i] xor GKeyS[i and keyLen] xor pck[i-1];
Inc(PCardinal(@GKeyS[keyLen-7])^,size);
end;
procedure TxorCrypt.InitKey(const XorKey; Interlude: Boolean = False);
const
KeyConst: array[0..3] of Byte = ($A1,$6C,$54,$87);
KeyConstInterlude: array[0..7] of Byte = ($C8,$27,$93,$01,$A1,$6C,$31,$97);
begin
if Interlude then begin
keyLen:=15;
Move(XorKey,GKeyS,8);
Move(KeyConstInterlude,GKeyS[8],8);
end else begin
keyLen:=7;
Move(XorKey,GKeyS,4);
Move(KeyConst,GKeyS[4],4);
end;
Move(GKeyS,GKeyR,16);
isInit:=True;
end;
end.