www.pudn.com > isprime.rar > Unit1.pas


unit Unit1; 
 
interface 
 
uses 
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, 
  StdCtrls; 
 
type 
  TForm1 = class(TForm) 
    Button1: TButton; 
    Button2: TButton; 
    Label1: TLabel; 
    Label2: TLabel; 
    Memo1: TMemo; 
    Memo3: TMemo; 
    Edit1: TEdit; 
    Edit2: TEdit; 
    Edit3: TEdit; 
    Label3: TLabel; 
    Label4: TLabel; 
    Label5: TLabel; 
    Label6: TLabel; 
    Label7: TLabel; 
    Label8: TLabel; 
    procedure Button1Click(Sender: TObject); 
    procedure Button2Click(Sender: TObject); 
  private 
    { Private declarations } 
  public 
    { Public declarations } 
  end; 
 
  TKeyByte = array[0..5] of Byte; 
  TDesMode = (dmEncry, dmDecry); 
 
var 
  Form1: TForm1; 
  Str: String; 
 
implementation 
 
uses Des; 
 
{$R *.DFM} 
 
procedure TForm1.Button1Click(Sender: TObject); 
var 
  ts1, ts2: TTimeStamp; 
begin 
  Label2.Caption := '0'; 
  Label1.Caption := IntToStr(Length(Memo1.Text)); 
  Update; 
  ts1 := DateTimeToTimeStamp(Now); 
  Str := EncryStr(Memo1.Text, Memo1.Text); 
  ts2 := DateTimeToTimeStamp(Now); 
  Label2.Caption := IntToStr(ts2.Time - ts1.Time); 
 
  Edit2.Text := EncryStrHex(Edit1.Text, Edit1.Text); 
end; 
 
procedure TForm1.Button2Click(Sender: TObject); 
var 
  ts1, ts2: TTimeStamp; 
begin 
  Label2.Caption := '0'; 
  Update; 
  ts1 := DateTimeToTimeStamp(Now); 
  Memo3.Text := DecryStr(Str, Memo1.Text); 
  ts2 := DateTimeToTimeStamp(Now); 
  Label2.Caption := IntToStr(ts2.Time - ts1.Time); 
 
  Edit3.Text := DecryStrHex(Edit2.Text, Edit1.Text); 
end; 
 
end.