⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 unit3.~pas

📁 实现DEA加密和解密算法
💻 ~PAS
字号:
unit Unit3;

interface

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

type
  TForm3 = class(TForm)
    Panel2: TPanel;
    Label3: TLabel;
    Edit2: TEdit;
    Panel1: TPanel;
    Label1: TLabel;
    Label2: TLabel;
    Button3: TButton;
    Edit1: TEdit;
    Panel3: TPanel;
    Button2: TButton;
    Button1: TButton;
    SaveDialog1: TSaveDialog;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure Button3Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form3: TForm3;

implementation
uses unit1;

{$R *.dfm}
type
TIntFunction=function(ip:pchar;i:pchar;o:pchar;b:integer;k:integer;kcx:pchar):Integer;stdcall;
const
   DllName= 'aesdll.dll';

procedure TForm3.Button1Click(Sender: TObject);
var
    FPointer2:TFarProc;
    HInst:THandle;
    dlldecrypt:TIntFunction;
    ProcName2:PChar;
    infile:array[0..50] of char;
    outfile:array[0..50] of char;
    inpath:array[0..50] of char;
    KCX:array[0..50] of char;
    BC:integer;
    KC:integer;
    re:integer;
begin
     lstrcpy(inpath,pchar(Form1.Label4.Caption));
     lstrcpy(infile,pchar(Form1.edit2.Text));
     lstrcpy(outfile,pchar(edit1.Text));
    lstrcpy(KCX,pchar(edit2.Text));
    Case Form1.RadioGroup1.ItemIndex of
      0:BC:=4;
      1:BC:=6;
      2:BC:=8;
    end;
    Case Form1.RadioGroup2.ItemIndex of
      0:KC:=4;
      1:KC:=6;
      2:KC:=8;
    end;
    ProcName2:='dlldecrypt';
    HInst:=SafeLoadLibrary(DllName);
    if HInst>0 then
       try
        FPointer2:=GetProcAddress(HInst,ProcName2);
         if FPointer2<>Nil then
            begin
              dlldecrypt:=TIntFunction(FPointer2);
              re:=dlldecrypt(inpath,infile,outfile,BC,KC,KCX);
              form1.edit1.Text:=inttostr(re);
            end
         else
           ShowMessage('Dll function not found');
        finally
          FreeLibrary(HInst);
        end
     else
      ShowMessage(DllName + 'Library not found');
      form3.Release;
end;

procedure TForm3.Button2Click(Sender: TObject);
begin
form3.Release;
end;

procedure TForm3.Button3Click(Sender: TObject);
begin
  with savedialog1 do
   if execute then
     edit1.Text:=filename;
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -