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

📄 unitexample.pas

📁 aes加密算法。用delphi语言实现。位数为128。
💻 PAS
字号:
{ *********************************************************************** }
{                                                                         }
{ AES Interface Unit 加密算法接口演示程序                                 }
{                                                                         }
{ 版权所有 (c) 2004 杨泽晖                                               }
{                                                                         }
{ *********************************************************************** }

unit UnitExample;

interface

uses
  Windows, Messages, SysUtils, Classes, Forms, Controls, StdCtrls, AES;

const
  MsgInformation = '信息';

  StrEncStrEmpty = '请输入要加密的字符串。';
  StrDecStrEmpty = '请输入要解密的字符串。';

type
  TFormAES = class(TForm)
    GroupBox1: TGroupBox;
    memSrcStr: TMemo;
    GroupBox2: TGroupBox;
    memEncStr: TMemo;
    edKey: TEdit;
    btnEnc: TButton;
    btnExit: TButton;
    btnDec: TButton;
    GroupBox3: TGroupBox;
    memDecStr: TMemo;
    Label1: TLabel;
    btnAbout: TButton;
    procedure btnDecClick(Sender: TObject);
    procedure btnEncClick(Sender: TObject);
    procedure btnAboutClick(Sender: TObject);
    procedure btnExitClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  FormAES: TFormAES;

implementation

{$R *.DFM}

procedure TFormAES.btnEncClick(Sender: TObject);
begin
  if Length(memSrcStr.Text) > 0 then
    {  --  调用标准例程 EncryptString 加密字符串  --  }
    memEncStr.Text := EncryptString(memSrcStr.Text, edKey.Text)
  else
    MessageBox(Handle, StrEncStrEmpty, MsgInformation, MB_ICONINFORMATION);
end;

procedure TFormAES.btnDecClick(Sender: TObject);
begin
  if Length(memEncStr.Text) > 0 then
    {  --  调用标准例程 DecryptString 加密字符串  --  }
    memDecStr.Text := DecryptString(memEncStr.Text, edKey.Text)
  else
    MessageBox(Handle, StrDecStrEmpty, MsgInformation, MB_ICONINFORMATION);
end;

procedure TFormAES.btnAboutClick(Sender: TObject);
var
  S: string;
begin
  S := 'AES 加密算法演示程序' + #13 + #13 +
    'Advanced Encryption Standard (AES)' + #13 +
    'Copyright (c) 1998-2001 EldoS, Alexander Ionov.' + #13 + #13 +
    'AES Interface Unit v1.0' + #13 +
    'Copyright (c) 2004 Jorlen Young.' + #13 + #13 +
    'Website:' + #13 +
    '         http://jorlen.51.net/' + #13 +
    '         http://mycampus.1155.net/' + #13 +
    '         http://mycampus.ecoo.net/' + #13 +
    '         http://mycampus.5500.org/' + #13 + #13 +
    'Email: stanley_xfx@163.com';        
  MessageBox(Handle, PChar(S), MsgInformation, MB_ICONINFORMATION);
end;

procedure TFormAES.btnExitClick(Sender: TObject);
begin
  Application.Terminate;
end;

end.

⌨️ 快捷键说明

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