Algorithm Math Delphi

const
C1 = 52845;
C2 = 11719;
Key = 1234; {Key değerini burada tanımlamayıp, Program içerisinde girebilirsiniz}
{ Standard Decryption algorithm - Copied from Borland}
function Decrypt(const S: String; Key: Word): String;
var
I: byte;
R: string;
begin
R := S;
for I := 1 to Length(S) do
begin
R[I] := char(byte(S[I]) xor (Key shr 8));
Key := (byte(S[I]) + Key) * C1 + C2;
end;
Result := R;
end;
{ Standard Encryption algorithm - Copied from Borland}
function Encrypt(const S: String; Key: Word): String;
Var
I: byte;
R: string;
begin
R := S;
for I := 1 to Length(S) do
begin
R[I] := char(byte(S[I]) xor (Key shr 8));
Key := (byte(R[I]) + Key) * C1 + C2;
end;
Result := R;
end;