resultStr:='';
key1:=****;
para1:=****;
para2:=****;
//解密密钥
for i:=1 to 9 do
begin
Ch:=OriginStr[size-9+i];
Result:=char(byte(Ch)xor(key1 shr 8));
key1:=(byte(Ch)+key1)*para1+para2;
function Encrypt(mStr: string; mKey: string): string;
var
I, J: Integer;
begin
J := 1;
Result := '';
for I := 1 to Length(mStr) do begin
Result := Result + Char(Ord(mStr[I]) xor Ord(mKey[J]));
if J + 1 <= Length(mKey) then
Inc(J)
else J := 1;
end;
{自己加步骤}
end;
function Decrypt(mStr: string; mKey: string): string;
var
I, J: Integer;
begin
J := 1;
Result := '';
{自己加步骤}
for I := 1 to Length(mStr) do begin
Result := Result + Char(Ord(mStr[I]) xor Ord(mKey[J]));
if J + 1 <= Length(mKey) then
Inc(J)
else J := 1;
end;
end;
function f(mStr: string; mKey: string): string;
var
I, J: Integer;
begin
Result := '';
J := 1;
for I := 1 to Length(mStr) do begin
Result := Result + Chr(Ord(mStr[I]) xor Ord(mKey[J]));
if J + 1 < Length(mKey) then
Inc(J)
else J := 1;
end;
end;
function Encrypt(mStr: string; mKey: string): string;
var
I, J: Integer;
begin
J := 1;
Result := '';
for I := 1 to Length(mStr) do begin
Result := Result + Char(Ord(mStr[I]) xor Ord(mKey[J]));
if J + 1 <= Length(mKey) then
Inc(J)
else J := 1;
end;
{自己加步骤}
end;
function Decrypt(mStr: string; mKey: string): string;
var
I, J: Integer;
begin
J := 1;
Result := '';
{自己加步骤}
for I := 1 to Length(mStr) do begin
Result := Result + Char(Ord(mStr[I]) xor Ord(mKey[J]));
if J + 1 <= Length(mKey) then
Inc(J)
else J := 1;
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
Memo2.Text := Decrypt(Encrypt(Memo1.Text, cKey), cKey);
end;