Home > Back-end >  Delphi exclusive or PHP
Delphi exclusive or PHP

Time:09-25

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * xor encryption * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
Const
XorKey: array [0.. 7] of Byte=($B2, $9, $BB, $55 and $93, $6 d, $44, $47);//string encryption

The function Enc (Str: string) : string;//character encryption function that is to use a different or encryption
Var
I, j: Integer;
The begin
Result:=';
J:=0;
For I:=1 to Length (Str) do
The begin
Result: the Result=+ IntToHex (Byte (Str) [I] xor XorKey [j], 2);//IntToHex integer hexadecimal
J:=(j + 1) mod 8;
end;
end;

The function Dec (Str: string) : string;//character decryption function
Var
I, j: Integer;
The begin
Result:=';
J:=0;
For I:=1 to Length (Str) div 2 do
The begin
Result: the Result=+ Char (StrToInt (' $' + Copy (Str, I * 2-1, 2)) xor XorKey [j]);
J:=(j + 1) mod 8;
end;
end;

Help to put the above two custom functions to PHP

CodePudding user response:

To individual help
  • Related