سلام
کد زیر رو نگاه کنید :
unit xtea;

interface

type
TTeaMsgBlock = array[0..1] of LongWord;
TTeaKeyBlock = array[0..3] of LongWord;

procedure XTeaCrypt(var V: TTeaMsgBlock; const K: TTeaKeyBlock);
procedure XTeaDecrypt(var V: TTeaMsgBlock; const K: TTeaKeyBlock);
function XTeaCryptStr(const Msg, Pwd: string): string;
function XTeaDecryptStr(const Msg, Pwd: string): string;

implementation
{ ================================================== ======================= }
const
DELTA = $9e3779b9;
N = 32;

procedure XTeaCrypt(var V: TTeaMsgBlock; const K: TTeaKeyBlock);
var
I: LongWord;
S: Int64;
begin
S := 0;
for I := 0 to N - 1 do begin
Inc(V[0], (V[1] shl 4 xor V[1] shr 5) + (V[1] xor S) + K[S and 3]);
Inc(S, DELTA);
Inc(V[1], (V[0] shl 4 xor V[0] shr 5) + (V[0] xor S) + K[S shr 11 and 3]);
end;
end;

procedure XTeaDecrypt(var V: TTeaMsgBlock; const K: TTeaKeyBlock);
var
I: LongWord;
S: Int64;
begin
S := DELTA * Int64(N);
for I := 0 to N - 1 do begin
Dec(V[1], (V[0] shl 4 xor V[0] shr 5) + (V[0] xor S) + K[S shr 11 and 3]);
Dec(S, DELTA);
Dec(V[0], (V[1] shl 4 xor V[1] shr 5) + (V[1] xor S) + K[S and 3]);
end;
end;

function XTeaCryptStr(const Msg, Pwd: string): string;
var
V: TTeaMsgBlock;
K: TTeaKeyBlock;
I, L, N: Integer;
begin
L := Length(Pwd); if L > SizeOf(K) then L := SizeOf(K);
K[0] := 0; K[1] := 0; K[2] := 0; K[3] := 0; Move(Pwd[1], K[0], L);

I := 1; L := Length(Msg);
if L > 0 then SetLength(Result, ((L - 1) div SizeOf(V) + 1) * SizeOf(V))
else SetLength(Result, 0);
while I <= L do begin
V[0] := 0; V[1] := 0;
N := L - I + 1; if N > SizeOf(V) then N := SizeOf(V);
Move(Msg[I], V[0], N);
XTeaCrypt(V, K);
Move(V[0], Result[I], SizeOf(V));
Inc(I, SizeOf(V))
end;
end;

function XTeaDecryptStr(const Msg, Pwd: string): string;
var
V: TTeaMsgBlock;
K: TTeaKeyBlock;
I, L, N: Integer;
begin
L := Length(Pwd); if L > SizeOf(K) then L := SizeOf(K);
K[0] := 0; K[1] := 0; K[2] := 0; K[3] := 0; Move(Pwd[1], K[0], L);

I := 1; L := Length(Msg);
if L > 0 then SetLength(Result, ((L - 1) div SizeOf(V) + 1) * SizeOf(V))
else SetLength(Result, 0);
while I <= L do begin
V[0] := 0; V[1] := 0;
N := L - I + 1; if N > SizeOf(V) then N := SizeOf(V);
Move(Msg[I], V[0], N);
XTeaDecrypt(V, K);
Move(V[0], Result[I], SizeOf(V));
Inc(I, SizeOf(V))
end;
end;
{ ================================================== ======================= }
end.


از این کد برای Encrypt و Decrypt کردن یه Text استفاده می کنم .
مثلا متنی با پسورد VhveI8fTsENBN7Fg به صورت زیر Encrypt میشه :
s1 := #030#018#131#113#064#181#035#204#010#225#200#142#1  82#151#064#249+
#040#171#248#252#051#168#062#252#072#140#171#243#0 43#245#220#181+
#104#253#079#024#083#194#205#087#244#214#180#063#1 72#144#007#178+
#160#035#217#088#153#071#066#187#155#222#136#076#2 28#184#246#105;

حالا با دستور
XTeaDecryptStr(S1, 'VhveI8fTsENBN7Fg')

این کد رو Decrypt میکنم .
تا اینجاش مشکلی نیست . ولی وقتی این کد رو توی یک فایل Text ذخیره کرده و طبق کد زیر
procedure TForm1.Button1Click(Sender: TObject);
var
F : TextFile ;
S ,S1,S2 : String ;
begin
If OpenDialog1.Execute Then
Begin
AssignFile(F,OpenDialog1.FileName);
Reset(F);
While Not Eof(F) Do
Begin
Readln(F,S);
S1 := S1 + S ;
End;
CloseFile(F);
End;
RichEdit1.Lines.Add(XTeaDecryptStr(S1, 'VhveI8fTsENBN7Fg'));
end;

میخوام که از فایل خونده و Decrypt اش کنه به مشکل می خورم
مشکلم اینه که S1 به صورت مثلا
 ' #030#018#131#113#064#181#035#204#010#225#200#142#1  82#151#064#249'

به Function من پاس میشه ، یعنی داخل کتیشن میفته و در اصل باید بدون کتیشن پاس بشه تا درست عمل کنه . هر کاری میکنم نمیتونم اونو از داخل کتیشن در بیارم .
حسابی قاطی کردم . خواهش می کنم یکی راهنماییم کنه
ممنون