The function of Decode (source: string) : string;//decryption
The function strToHexStr (STR: string) : string;//string into 16 string
The function HexStrToStr (const S: string) : string;//hexadecimal string into a string
//decryption
The function of Decode (source: string) : string;
Var
Source_Len, Len: integer;
The Count, c1 and c2: integer;
Code: an array of byte [0.. 7];
A1, a2: byte;
Ind: dword;
Decode_Str: string;
Label L1 and L2;
The begin
Result:=';
Decode_Str:=';
Code [2] :=$fc;
Code [4] :=$f0;
Code [6] :=$c0;
Len:=0;
A1:=0;
A2:=0;
C1:=2;
C2:=0;
Ind:=0;
Count:=0;
Source_Len:=Length (source);
While (the Count & lt; Source_Len) do
The begin
If (word (Source) [Count + 1] - $3 c) & lt; 0 then
The begin
Decode_Str:=Decode_Str + Source [Count + 1];
Inc (Len);
Inc (Count);
A1:=0;
A2:=0;
C1:=2;
C2:=0;
Ind:=0;
The Continue;
//break;
end;
A1:=word (Source) [Count + 1] - $3 c;
If Len & gt;=Source_Len then
The begin
break;
end;
If (c2 + 6) & lt; 8 then
The begin
Goto L2;
end;
Ind:=a1 and $3 f;
Ind:=ind SHR (6 - c1);
Decode_Str:=Decode_Str + CRH (ind or a2);
Inc (Len);
C2:=0;
If c1 & gt; 6 then=
The begin
C1:=2;
Goto L1.
end;
Inc (c1, 2);
L2: a2:=a1 SHL c1;
A2:=a2 and code [c1];
C2:=c2 + (8 - c1);
L1: inc (count);
end;
SetLength (Decode_Str, Len);
Result:=Decode_Str;
end;
//string into 16 string
The function strToHexStr (STR: string) : string;
Var
C: char;
Ss: string;
I: integer;
The begin
While str<> ' 'do begin
C:=STR [1].
Ss:=ss + format (' % 0 x '[word] (c));
Delete (STR, 1, 1);
end;
StrtohexStr:=ss;
end;
//hexadecimal string into a string
The function HexStrToStr (const S: string) : string;
Var
T: Integer;
Ts: the string;
M, Code: Integer;
The begin
T:=1;
Result:=';
While t<=Length (S) do
The begin//XLH 2006.10.21
While (t<=Length (S)) and (not (S [t] in [' 0 '... '9', 'A'. The 'F', 'A'. The 'F'])) do
Inc (t);
If (t + 1 & gt; Length (S)) or (not (S (t + 1] in [' 0 '... '9', 'A'. The 'F', 'A'. The 'F'])) then
Ts:='$' + S [t]
The else
Ts:='$' [t] + S + S (t + 1),
Val (ts, M Code);
If Code=0 then
Result: the Result=+ CRH (M);
Inc (t, 2);
end;
end;
The
Procedure TForm1. Button2Click (Sender: TObject);
The begin
//edit2 23 32 6 c 48 to 56 f=41 4 c 3 c and 3 c and 3 c e c 78 3 c and 3 c c 3 c 52, 68, 70 3 e and c 3 c 64 5 a 7 a 5 d 63, 65, 48, 76, 79, 75, 77 78 4 e 46 43 64 5 a, 6 b 78 21
Edit1. Text:=strToHexStr (Decode (HexStrToStr (edit2. Text)));
Edit3. Text:=HexStrToStr (edit1. Text);
end;
What is wrong
CodePudding user response:
The above code no shrinkage, such code, you look good?CodePudding user response: