The function is as follows:
Function Dip (STR: string): string;
VaR
M, str1: string;
ASC, asc1: byte;
I: integer;
Begin
M: = 'asdfdghjvvvacw ';
For I: = 1 to length (STR) Do
Begin
ASC: = ord (STR [I]);
ASC: = ASC and $ F;
Asc1: = ord (M [I]);
Asc1: = asc1 and $ F;
Asc1: = asc xor asc1;
ASC: = ord (STR [I]);
ASC: = ASC and $ F0;
ASC: = ASC + asc1;
Str1: = str1 + CHR (ASC );
End;
Result: = str1;
End;
Call
Edit2.text: = Dip (edit1.text );
The above is the decryption function. When the parameter is '100 (= 0 & 336 (820 ', the returned result is an IP Address: 202.97.246.227
The question is, how to write the encryption function to change this IP address to 336 (= 0 & 820 (166
That is, fun ('1970. 97.246.227 ') = '1970 (= 0 & 202 (100'
**************************************** **************************************** *
This encryption function is reversible,
Dip ('2017 (= 0 & 336 (820 ') = '2017. 97.246.227'
Call it again
Dip ('1970. 97.246.227 ') = '1970 (= 0 & 202 (336'
**************************************** ***********************
Encryption only changes the four-bit lower of the original code and one key, so it is restored when it is different from the same key or