Hier ist sie:
Function Encryp(Const S: String; Key: Word; rueckw: Boolean): String;
Var
I: byte;
oben, unten: byte;
Begin
Setlength(Result, length(S));
If Rueckw Then Begin
For I := Length(S) Downto 1 Do Begin
Result[I] := char(byte(S[I]) Xor (Key Shr 8));
Key := (byte(Result[I]) + Key) * C1 + C2;
End;
End
Else Begin
For I := 1 To Length(S) Do Begin
Result[I] := char(byte(S[I]) Xor (Key Shr 8));
Key := (byte(Result[I]) + Key) * C1 + C2;
End;
End;
Encryp := result;
End;