procedure EncryptFile(var InS,OutS:strings;Key:LongWord);
var
X:Integer;
C:Byte;
begin
FOR X := 0 TO length(Ins) - 1 DO
begin
C := InS(X);
C := (C xor (Key shr 8));
Key := (C + Key) * C1 + C2;
OutS(X) := C;
end;
end;
procedure DecryptFile(var InS,OutS:strings;Key:LongWord);
var
X:Integer;
C,O:Byte;
begin
FOR X:=0 TO MS.Size - 1 DO
begin
C := InS(X);
O:=C;
C:=(C xor (Key shr 8));
Key:=(O + Key) * C1 + C2;
OutS(X) := C;
end;
end;