Delphi字符串隐藏


本文整理自网络,侵删。

  Delphi字符串隐藏 


代码:
unit Unit1;
interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;

type
TForm1 = class(TForm)
    Button1: TButton;
    Button2: TButton;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
private
    { Private declarations }
public
    { Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var
t:array[1..14] of char;     //用数组来实现隐藏
begin
t[1]:=Char(103);
t[2]:=Char(111);
t[3]:=Char(111);
t[4]:=Char(100);
t[5]:=Char(32);
t[6]:=Char(106);
t[7]:=Char(111);
t[8]:=Char(98);
t[9]:=Char(44);
t[10]:=Char(32);
t[11]:=Char(109);
t[12]:=Char(97);
t[13]:=Char(110);
t[14]:=Char(33);
Showmessage(t);               //英文的“good job, man!”
end;


procedure TForm1.Button2Click(Sender: TObject);
var
t:array[1..20] of char;          //用数组来实现隐藏
begin
t[1]:=Char(185);
t[2]:=Char(167);
t[3]:=Char(207);
t[4]:=Char(178);
t[5]:=Char(196);
t[6]:=Char(227);
t[7]:=Char(163);
t[8]:=Char(172);
t[9]:=Char(215);
t[10]:=Char(162);
t[11]:=Char(178);
t[12]:=Char(225);
t[13]:=Char(179);
t[14]:=Char(201);
t[15]:=Char(185);
t[16]:=Char(166);
t[17]:=Char(193);
t[18]:=Char(203);
t[19]:=Char(163);
t[20]:=Char(161);
Showmessage(t);                     //中文的“恭喜你,注册成功了!”
end;


end.
有人会觉得这样写代码很累,没关系,这里有批量生成上面结果的代码,我正用之...
且上面代码均为其生成之...
edit1.text输入你的提示字符串,edit2.text输入为你预定义的变量名,默认为't'...
点击即可生成像上面的代码,保存在ByTeCrypt.txt,直接copy使用之...
复制内容到剪贴板
代码:
unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;

type
TForm1 = class(TForm)
    Button1: TButton;
    Edit1: TEdit;
    Edit2: TEdit;
    Label1: TLabel;
    GroupBox1: TGroupBox;
    Label2: TLabel;
    Label3: TLabel;
    procedure Button1Click(Sender: TObject);
private
    { Private declarations }
public
    { Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var
    wFile:TextFile;
    wFileName,s,t:String;
    i:Integer;

begin
    s:=Edit1.Text;
    t:=Edit2.Text;
    if length(s)=0 then
        begin
           showmessage('Please input your string');
           exit;
        end;
    if length(t)=0 then
        begin
           showmessage('请输入变量名');
           exit;
        end;
    t:=Edit2.Text;
    wFileName:= 'ByTeCrypt.txt';
    AssignFile(wFile, wFileName);
    Rewrite(wFile);

    Writeln(wFile,'var');
    Writeln(wFile,' '+t+':array[1..'+IntToStr(Length(s))+'] of char;');                  //生成定义t:array[1..?] of char
    Writeln(wFile,'begin');
    for i:=1 to Length(s) do
       begin
          Writeln(wFile, ' '+t+'['+IntToStr(i)+']:=Char('+IntToStr(Ord(s[i]))+');');     //生成语句t[?]:=Char(?);
       end;
    Writeln(wFile,' Showmessage('+t+');');
    Writeln(wFile,'end;');
    CloseFile(wFile);
    showmessage('执行完毕,请查看同目录下ByTeCrypt.txt文件!');

end;

end.

相关阅读 >>

Delphi dbexpress的upwherekeyonly的使用注意事项

Delphi 根据邮箱地址分离出@前的内容

Delphi winapi: openprocess、getexitcodeprocess、terminateprocess (qq)

Delphi用idtcpserver和idtcpclient传输文件

Delphi加密access文件头

Delphi 获取内网所有ip地址

Delphi 系统任务栏 窗口状态显示进度

Delphi 计算运行耗时的方法1

Delphi tcolortohex 与 hextotcolor

Delphi processid, process handle, window handle 之间的互相转换

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...