本帖最后由 冥界3大法王 于 2020-9-25 23:05 编辑
[Delphi] 纯文本查看 复制代码 unit Unit1;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants,
System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs,
Vcl.StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
function Encode(source: string): string;
var
Source_Len, Len: integer;
Count, c: integer;
a1, a2: byte;
ind: dword;
Encode_Str: string;
begin
Result := '';
Encode_Str := '';
Len := 0;
a1 := 0;
a2 := 0;
c := 0;
ind := 0;
Count := 0;
Source_Len := Length(source);
while Count < Source_Len do
begin
if Len >= $2710 then
break;
ind := ord(source[Count + 1]);
ind := ind shr (c + 2);
a1 := ind or a2;
a1 := a1 and $3f;
ind := ord(source[Count + 1]);
ind := ind shl (8 - (c + 2));
ind := ind shr 2;
a2 := ind and $3f;
inc(c, 2);
if c >= 6 then
begin
if Len >= $270f then
begin
Encode_Str := Encode_Str + chr(a1 + $3c);
inc(Len);
end
else
begin
Encode_Str := Encode_Str + chr(a1 + $3c);
Encode_Str := Encode_Str + chr(a2 + $3c);
Inc(Len, 2);
end;
c := 0;
a2 := 0;
end
else
begin
Encode_Str := Encode_Str + chr(a1 + $3c);
Inc(Len);
end;
inc(Count);
end;
if c > 0 then
begin
Encode_Str := Encode_Str + chr(a2 + $3c);
Inc(Len);
end;
SetLength(Encode_Str, Len);
Result := Encode_Str;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
ShowMessage(Encode('ABCDEFGHIJKLMNOPQRSTUVWXYZ'));
end;
end.
F9编译后
链接: https://pan.baidu.com/s/13YONQO9fDtdXCiQgRDsrlg 提取码: m9b9
你自己 IDA F5 吧
|