unit prg_gost; interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, Mask, ExtCtrls, Buttons, Spin, GostBase, indication; type TBaseForm = class(TForm) Panel1: TPanel; MaskEdit1: TMaskEdit; MaskEdit2: TMaskEdit; Panel2: TPanel; MaskEdit3: TMaskEdit; MaskEdit4: TMaskEdit; Panel4: TPanel; MaskEdit5: TMaskEdit; Button2: TButton; Panel5: TPanel; Panel7: TPanel; MaskEdit11: TMaskEdit; MaskEdit12: TMaskEdit; Panel8: TPanel; MaskEdit13: TMaskEdit; MaskEdit14: TMaskEdit; Panel9: TPanel; MaskEdit15: TMaskEdit; MaskEdit16: TMaskEdit; Panel10: TPanel; MaskEdit17: TMaskEdit; MaskEdit18: TMaskEdit; Button3: TButton; BitBtn1: TBitBtn; Panel3: TPanel; SpinEdit1: TSpinEdit; Button4: TButton; Button5: TButton; MaskEdit19: TMaskEdit; MaskEdit20: TMaskEdit; MaskEdit6: TMaskEdit; MaskEdit7: TMaskEdit; MaskEdit8: TMaskEdit; Panel6: TPanel; MaskEdit21: TMaskEdit; MaskEdit10: TMaskEdit; MaskEdit9: TMaskEdit; MaskEdit22: TMaskEdit; MaskEdit23: TMaskEdit; MaskEdit24: TMaskEdit; Image1: TImage; Label1: TLabel; procedure BitBtn1Click(Sender: TObject); procedure FormActivate(Sender: TObject); procedure Button3Click(Sender: TObject); procedure Button2Click(Sender: TObject); procedure Button4Click(Sender: TObject); procedure Button5Click(Sender: TObject); procedure FormResize(Sender: TObject); procedure SpinEdit1Change(Sender: TObject); private { Private declarations } public { Public declarations } protected end; var BaseForm: TBaseForm; tmp, brk: Boolean; xData: tDataUnit; implementation uses tabl, keys; {$R *.DFM} procedure TBaseForm.FormActivate(Sender: TObject); var i,j: Integer; begin Tmp:=False; // Начальные установки TableForm.Show; Randomize; for i := 1 to 4 do for j := 1 to 256 do begin tabl.SubstitutionTable[i-1,j-1] := random(255); TableForm.F1Book1.TextRC[i+1,j] := IntToStr(tabl.SubstitutionTable[i-1,j-1]); end; TableForm.Close; KeyForm.Show; KeyForm.Caption := 'Задайте ключевую информацию:'; end; procedure TBaseForm.Button3Click(Sender: TObject); begin brk := False; If tmp = False then begin { Заполнение структуры типа tDataUnit шифруемыми данными } xData.W0:=StrToInt(Trim(MaskEdit4.Text)); xData.W1:=StrToInt(Trim(MaskEdit3.Text)); xData.W2:=StrToInt(Trim(MaskEdit2.Text)); xData.W3:=StrToInt(Trim(MaskEdit1.Text)); BaseEncodeSet(xData, SubstitutionTable, xKeyWord); Base_indication; tmp := True; end else begin Decode_indication(xData); BaseDecodeSet(xData, SubstitutionTable, xKeyWord); Base_indication; tmp := False; end; end; procedure TBaseForm.BitBtn1Click(Sender: TObject); begin KeyForm.Show; end; procedure TBaseForm.Button2Click(Sender: TObject); begin TableForm.Show; end; procedure TBaseForm.Button4Click(Sender: TObject); begin SpinEdit1.Value := 0; end; procedure TBaseForm.Button5Click(Sender: TObject); begin BaseForm.Close; end; procedure TBaseForm.FormResize(Sender: TObject); begin Width := 640; Height := 485; Top := 100; Left := 100; end; procedure TBaseForm.SpinEdit1Change(Sender: TObject); begin if SpinEdit1.Value <> 0 then Button4.Enabled := True else Button4.Enabled := False; end; end.