home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2003 February
/
Chip_2003-02_cd1.bin
/
ctenari
/
Hytha
/
HCrypt.exe
/
SR_KOP.RAR
/
SRC
/
Unit1.pas
< prev
next >
Wrap
Pascal/Delphi Source File
|
2002-10-31
|
23KB
|
846 lines
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, DCPcrypt2, DCPsha1, DCPtwofish, DCPtea, DCPserpent,
DCPrijndael, DCPrc6, DCPrc5, DCPrc4, DCPrc2, DCPmisty1, DCPmars, DCPidea,
DCPice, DCPdes, DCPblockciphers, DCPcast256, DCPcast128, DCPblowfish,
jpeg, ExtCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
DCP_blowfish1: TDCP_blowfish;
DCP_cast1281: TDCP_cast128;
DCP_cast2561: TDCP_cast256;
DCP_des1: TDCP_des;
DCP_3des1: TDCP_3des;
DCP_ice1: TDCP_ice;
DCP_thinice1: TDCP_thinice;
DCP_ice21: TDCP_ice2;
DCP_idea1: TDCP_idea;
DCP_mars1: TDCP_mars;
DCP_misty11: TDCP_misty1;
DCP_rc21: TDCP_rc2;
DCP_rc41: TDCP_rc4;
DCP_rc51: TDCP_rc5;
DCP_rc61: TDCP_rc6;
DCP_rijndael1: TDCP_rijndael;
DCP_serpent1: TDCP_serpent;
DCP_tea1: TDCP_tea;
DCP_twofish1: TDCP_twofish;
DCP_sha11: TDCP_sha1;
Edit1: TEdit;
Label1: TLabel;
Label2: TLabel;
Edit2: TEdit;
Edit3: TEdit;
Label3: TLabel;
Button2: TButton;
Button3: TButton;
Button4: TButton;
Button5: TButton;
Button6: TButton;
OpenDialog1: TOpenDialog;
OpenDialog2: TOpenDialog;
SaveDialog1: TSaveDialog;
Label4: TLabel;
Edit4: TEdit;
Button7: TButton;
SaveDialog2: TSaveDialog;
ListBox1: TListBox;
Button8: TButton;
Button9: TButton;
Button10: TButton;
Button11: TButton;
Button12: TButton;
Button13: TButton;
Button14: TButton;
Button15: TButton;
Button16: TButton;
Button17: TButton;
Button18: TButton;
Button19: TButton;
Button20: TButton;
Button21: TButton;
Button22: TButton;
Button23: TButton;
Button24: TButton;
Button25: TButton;
Button26: TButton;
Button27: TButton;
CheckBox1: TCheckBox;
CheckBox2: TCheckBox;
Edit5: TEdit;
Label5: TLabel;
Memo1: TMemo;
Button28: TButton;
Label6: TLabel;
CheckBox3: TCheckBox;
CheckBox4: TCheckBox;
Image1: TImage;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button5Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button6Click(Sender: TObject);
procedure Button7Click(Sender: TObject);
procedure Button27Click(Sender: TObject);
procedure Button8Click(Sender: TObject);
procedure Button26Click(Sender: TObject);
procedure Button9Click(Sender: TObject);
procedure Button10Click(Sender: TObject);
procedure Button11Click(Sender: TObject);
procedure Button12Click(Sender: TObject);
procedure Button13Click(Sender: TObject);
procedure Button14Click(Sender: TObject);
procedure Button15Click(Sender: TObject);
procedure Button16Click(Sender: TObject);
procedure Button17Click(Sender: TObject);
procedure Button18Click(Sender: TObject);
procedure Button19Click(Sender: TObject);
procedure Button20Click(Sender: TObject);
procedure Button21Click(Sender: TObject);
procedure Button22Click(Sender: TObject);
procedure Button23Click(Sender: TObject);
procedure Button24Click(Sender: TObject);
procedure Button25Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure CheckBox1Click(Sender: TObject);
procedure CheckBox2Click(Sender: TObject);
procedure Button28Click(Sender: TObject);
procedure CheckBox4Click(Sender: TObject);
procedure Edit1Change(Sender: TObject);
procedure Edit1Click(Sender: TObject);
procedure Edit2Change(Sender: TObject);
procedure Edit4Change(Sender: TObject);
procedure Edit3Change(Sender: TObject);
private
{ Private declarations }
public
procedure CanCrypt;
procedure Ins(Co:String);
procedure MyRandomize;
function MyRandom:Byte;
{ Public declarations }
end;
const TempName='$$$FHC1$.TMP';
type PSif=^TSif;
TSif=Record
Next:PSif;
N:Integer; // ╚φslo Üifry
KGen:Boolean; // Byl u₧ klφΦ generovßn / naΦten ?
Key:Array[0..1024]of Byte; // KlφΦ
Pass:Array[0..1024]of Byte; // Heslo
end;
const RNDL=1024;
var
Form1: TForm1;
CC:Array[0..17] of TDCP_BlockCipher;
Sifry,SPom,SPom2:PSif; // Seznam Üifer
Randomized:Boolean;
RBuf:Array[0..RNDL]of Byte;
RP:LongInt;
implementation
uses Unit2;
{$R *.dfm}
procedure TForm1.MyRandomize;
var I:LongInt;
begin
Form2.Visible:=True;Form2.RePaint;
Form1.Visible:=False;
RPL:=0;
//Application.MessageBox(PChar(IntToStr(RPL)),'',MB_OK);
repeat
Application.ProcessMessages;
until RPL>=RNDL;
//Application.MessageBox(PChar(IntToStr(RPL)),'',MB_OK);
for I:=0 to RNDL-1 do
RBuf[I]:=RBuf2[I];
RPL:=0;
Form2.Visible:=False;
Form1.Visible:=True;
RP:=0;
Randomized:=True;
end;
function TForm1.MyRandom:Byte;
begin
if not(Randomized)or(RP>RNDL) then Form1.MyRandomize; // Vygeneruj buffer nßhodn²ch Φφsel
MyRandom:=RBuf[RP];
RP:=RP+1;if (RP>RNDL) then Randomized:=False;
end;
function SHA1(Co:String):String;
Type HBuf=Array[0..1024] of Byte;
var Pom:String;
H:HBuf;
function HStr(B:HBuf;L:Word):String;
var Pom:String;
I:Word;
begin
Pom:='';
for I:=0 to ((L div 8)-1) do
Pom:=Pom+IntToHex(B[I],2);
HStr:=Pom;
end;
begin
with Form1.DCP_sha11 do begin
Init;
Update(Co[1],Length(Co));
Final(H);
Pom:=HStr(H,HashSize);
end;
SHA1:=Pom;
end;
procedure TForm1.CanCrypt; // Povolit tlaΦφtka Crypt / Decrypt ?
begin
Button5.Enabled:=True; // Crypt
Button6.Enabled:=True; // Decrypt
if ListBox1.Count=0 then Button5.Enabled:=False;
if Length(Edit1.Text)=0 then Button5.Enabled:=False;
if Length(Edit2.Text)=0 then begin
Button5.Enabled:=False;
Button6.Enabled:=False;
end;
if Length(Edit4.Text)=0 then Button6.Enabled:=False;
if (CheckBox2.Checked)and(Length(Edit3.Text)=0) then begin
Button5.Enabled:=False;
Button6.Enabled:=False;
end;
end;
procedure TForm1.Ins(Co:String);
var I:LongInt;
begin
for I:=ListBox1.Count-1 DownTo 0 do
if ListBox1.Selected[I] then break;
ListBox1.Items.Insert(I,Co);
CanCrypt;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
Form1.Close;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
if OpenDialog1.Execute then begin
Edit1.Text:=OpenDialog1.FileName;
Edit2.Text:=OpenDialog1.FileName+'.HCR';
Edit3.Text:=OpenDialog1.FileName+'.HCK';
end;
end;
procedure TForm1.Button5Click(Sender: TObject);
const LBuf=$F000;
var F3,F:File;
D:Array[0..LBuf] of Byte;
E1,E2,E3:Integer;
I:Word;
S1,S2:String;
X:LongInt;
H:Array[0..1024] of Byte;
Has:Record
Ci:Word;
Buf:Array[0..1023] of Byte;
end;
procedure Sifruj(Sif:PSif;InF,OutF:String);
var D1,D2:Array[0..LBuf] of Byte;
F1,F2:File;
Key:Array[0..1024] of Byte;
I:Word;
begin
Memo1.Lines.Add('Crypt: '+CC[Sif.N].Algorithm);
CC[Sif.N].CipherMode:=cmCFB8bit;
// Aktivuj klφΦ
for I:=0 to 1024 do Key[I]:=Sif.Key[I] xor Sif.Pass[I];
CC[Sif.N].Init(Key,CC[Sif.N].MaxKeySize div 8,nil);
// Otev°i soubory
AssignFile(F1,InF);
Reset(F1,1);
AssignFile(F2,OutF);
Rewrite(F2,1);
// Projφ₧d∞j soubory
while not eof(F1) do begin
for I:=0 to LBuf do begin
D1[I]:=0;
D2[I]:=0;
end;
BlockRead(F1,D1[0],LBuf,E1);
CC[Sif.N].EncryptCFB8bit(D1[0],D2[0],E1);
BlockWrite(F2,D2[0],E1,E2);
end;
// Zav°i soubory
CloseFile(F2);
CloseFile(F1);
// Sma₧ objekt Üifry
CC[Sif.N].Burn;
end;
begin
Memo1.Lines.Add('----- Crypt: -----');
Button1.Enabled:=False;
Button5.Enabled:=False;
Button6.Enabled:=False;
if CheckBox2.Checked then begin // Pou₧ije se klφΦ ?
AssignFile(F3,Edit3.Text);
Rewrite(F3,1);
end;
for X:=ListBox1.Count-1 downto 0 do begin
New(SPom);
for I:=0 to 17 do if (ListBox1.Items.Strings[X]=CC[I].Algorithm) then break; // Detekce Üifry z °et∞zce
Spom^.N:=I;
Spom^.Next:=Sifry; // prvnφ Üifru dß na konec novΘ
Sifry:=SPom; // Prvnφ Üifru nastavφ tuhle
SPom^.KGen:=True; // KlφΦ u₧ byl generovßn
for I:=0 to 1024 do begin // Vymazat klφΦ i heslo
SPom^.Key[I]:=0;
SPom^.Pass[I]:=0;
end;
if CheckBox1.Checked then begin // Pou₧φvß se heslo ???
for I:=1 to Length(Edit5.Text) do // Nejd°φv heslo
SPom^.Pass[I-1]:=Ord(Edit5.Text[I]);
for I:=1 to Length(SHA1(Edit5.Text)) do // Pak SHA-1 hash hesla (kdyby heslo bylo delÜφ ne₧ max. dΘlka klφΦe)
SPom^.Pass[I-1]:=SPom^.Pass[I-1] xor Ord(SHA1(Edit5.Text)[I]);
end;
if CheckBox2.Checked then begin // Pou₧φvß se klφΦ ???
// (.....)
for I:=0 to ((CC[SPom^.N].MaxKeySize div 8)-1) do SPom^.Key[I]:=MyRandom; // Vygenerovat nßhodn∞
// (.....)
BlockWrite(F3,SPom^.N,2,E3); // ╚φslo Üifry (0-17)
BlockWrite(F3,SPom^.Key,1024,E3); // KlφΦ
end;
end;
if CheckBox2.Checked then CloseFile(F3); // Pou₧ije se klφΦ ?
// P°enΘst do temp. souboru
S1:=Edit1.Text;S2:=Edit2.Text;
AssignFile(F,S1);Reset(F,1);
AssignFile(F3,S2);Rewrite(F3,1);
while not eof(F) do begin
BlockRead(F,D,LBuf,E3);
BlockWrite(F3,D,E3,E1);
end;
CloseFile(F3);CloseFile(F);
while Sifry<>nil do begin
if FileExists(TempName) then DeleteFile(TempName);
AssignFile(F,S2);Reset(F,1);
AssignFile(F3,TempName);Rewrite(F3,1);
while not eof(F) do begin
BlockRead(F,D,LBuf,E3);
BlockWrite(F3,D,E3,E1);
end;
CloseFile(F3);CloseFile(F);
if FileExists(S2) then DeleteFile(S2);
Sifruj(Sifry,TempName,S2);
SPom:=Sifry^.Next;
Dispose(Sifry);
Sifry:=SPom;
if FileExists(TempName) then DeleteFile(TempName);
end;
//// Hash
if CheckBox2.Checked then begin // Pou₧ije se klφΦ ?
Has.Ci:=100; // Init
for I:=0 to 1023 do Has.Buf[I]:=0;
AssignFile(F3,Edit3.Text);
Reset(F3,1);
Form1.DCP_sha11.Init;
while not eof(F3) do begin
BlockRead(F3,D,LBuf,E3);
Form1.DCP_sha11.Update(D,E3);
end;
Form1.DCP_sha11.Final(H);
for I:=0 to (Form1.DCP_sha11.HashSize div 8)-1 do Has.Buf[I]:=H[I];
CloseFile(F3);
AssignFile(F3,Edit2.Text);
Reset(F3,1);
Form1.DCP_sha11.Init;
while not eof(F3) do begin
BlockRead(F3,D,LBuf,E3);
Form1.DCP_sha11.Update(D,E3);
end;
Form1.DCP_sha11.Final(H);
for I:=0 to (Form1.DCP_sha11.HashSize div 8)-1 do Has.Buf[I+512]:=H[I];
CloseFile(F3);
AssignFile(F3,Edit3.Text);
Reset(F3,1);
Seek(F3,FileSize(F3));
BlockWrite(F3,Has.Ci,2,E3);
BlockWrite(F3,Has.Buf,1024,E3);
CloseFile(F3);
//// Hash(konec)
end;
Button1.Enabled:=True;
Button5.Enabled:=True;
Button6.Enabled:=True;
CanCrypt;
Memo1.Lines.Add(' ');
end;
procedure TForm1.Button4Click(Sender: TObject);
begin
if OpenDialog2.Execute then Edit3.Text:=OpenDialog2.FileName;
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
if SaveDialog1.Execute then begin
Edit2.Text:=SaveDialog1.FileName;
if UpperCase(Copy(SaveDialog1.FileName,Length(SaveDialog1.FileName)-3,4))='.HCR' then begin
Edit4.Text:=Copy(SaveDialog1.FileName,1,Length(SaveDialog1.FileName)-4);
Edit3.Text:=Copy(SaveDialog1.FileName,1,Length(SaveDialog1.FileName)-4)+'.HCK';
end;
end;
end;
procedure TForm1.Button6Click(Sender: TObject);
const LBuf=$F000;
var F3,F:File;
H:Array[0..1024] of Byte;
D:Array[0..LBuf] of Byte;
E1,E2,E3:Integer;
I:Word;
S1,S2:String;
L,X:LongInt;
HE1,HE2:Boolean;
Has,Has2:Record
Ci:Word;
Buf:Array[0..1023] of Byte;
end;
procedure Sifruj(Sif:PSif;InF,OutF:String);
var D1,D2:Array[0..LBuf] of Byte;
F1,F2:File;
Key:Array[0..1024] of Byte;
I:Word;
begin
if not(CheckBox3.Checked) then Memo1.Lines.Add('Decrypt: '+CC[Sif.N].Algorithm);
CC[Sif.N].CipherMode:=cmCFB8bit;
// Aktivuj klφΦ
for I:=0 to 1024 do Key[I]:=Sif.Key[I] xor Sif.Pass[I];
CC[Sif.N].Init(Key,CC[Sif.N].MaxKeySize div 8,nil);
// Otev°i soubory
AssignFile(F1,InF);
Reset(F1,1);
AssignFile(F2,OutF);
Rewrite(F2,1);
// Projφ₧d∞j soubory
while not eof(F1) do begin
for I:=0 to LBuf do begin
D1[I]:=0;
D2[I]:=0;
end;
BlockRead(F1,D1[0],LBuf,E1);
CC[Sif.N].DecryptCFB8bit(D1[0],D2[0],E1);
BlockWrite(F2,D2[0],E1,E2);
end;
// Zav°i soubory
CloseFile(F2);
CloseFile(F1);
// Sma₧ objekt Üifry
CC[Sif.N].Burn;
end;
begin
Memo1.Lines.Add('----- Decrypt: -----');
Button1.Enabled:=False;
Button5.Enabled:=False;
Button6.Enabled:=False;
if not(CheckBox2.Checked) then begin ////// NEPOUÄ═V┴ SE KL═╚
for X:=0 to ListBox1.Count-1 do begin
SPom:=Sifry; // Star² zaΦßtek schovß
New(Sifry);
for I:=0 to 17 do if (ListBox1.Items.Strings[X]=CC[I].Algorithm) then break; // Detekce Üifry z °et∞zce
Sifry^.N:=I;
Sifry^.Next:=SPom; // PokraΦuje star²mi Üiframi
Sifry^.KGen:=True; // KlφΦ u₧ byl generovßn
for I:=0 to 1024 do begin // Vymazat klφΦ i heslo
Sifry^.Key[I]:=0;
Sifry^.Pass[I]:=0;
end;
if CheckBox1.Checked then begin // Pou₧φvß se heslo ???
for I:=1 to Length(Edit5.Text) do // Nejd°φv heslo
Sifry^.Pass[I-1]:=Ord(Edit5.Text[I]);
for I:=1 to Length(SHA1(Edit5.Text)) do // Pak SHA-1 hash hesla (kdyby heslo bylo delÜφ ne₧ max. dΘlka klφΦe)
Sifry^.Pass[I-1]:=Sifry^.Pass[I-1] xor Ord(SHA1(Edit5.Text)[I]);
end;
end;
end else begin ////////////////////////// POUÄ═V┴ SE KL═╚
//// Hash
Has.Ci:=0; // Init
Has2.Ci:=0;
for I:=0 to 1023 do begin
Has.Buf[I]:=0;
Has2.Buf[I]:=0;
end;
AssignFile(F3,Edit3.Text);
Reset(F3,1);
Form1.DCP_sha11.Init;
L:=0;
while L<(FileSize(F3)-1026) do begin
BlockRead(F3,D,1,E3);
L:=L+E3;
Form1.DCP_sha11.Update(D,E3);
end;
Form1.DCP_sha11.Final(H);
for I:=0 to (Form1.DCP_sha11.HashSize div 8)-1 do Has2.Buf[I]:=H[I];
CloseFile(F3);
AssignFile(F3,Edit2.Text);
Reset(F3,1);
Form1.DCP_sha11.Init;
while not eof(F3) do begin
BlockRead(F3,D,LBuf,E3);
Form1.DCP_sha11.Update(D,E3);
end;
Form1.DCP_sha11.Final(H);
for I:=0 to (Form1.DCP_sha11.HashSize div 8)-1 do Has2.Buf[I+512]:=H[I];
CloseFile(F3);
//// Hash(konec)
AssignFile(F3,Edit3.Text);
Reset(F3,1);
while not Eof(F3) do begin
New(SPom);
BlockRead(F3,SPom^.N,2,E3); // ╚φslo Üifry (0-17)
BlockRead(F3,SPom^.Key,1024,E3); // KlφΦ
if SPom^.N>=100 then begin
for I:=0 to 1023 do Has.Buf[I]:=SPom^.Key[I];
Has.Ci:=SPom^.N;
Dispose(SPom);
Continue;
end;
if SPom^.N>17 then SPom^.N:=17; // Ochrana p°ed spadnutφm programu p°i ÜpatnΘm klφΦi
Spom^.Next:=nil; // DalÜφ Üifra u₧ nenφ
SPom^.KGen:=True; // KlφΦ u₧ byl generovßn
SPom2:=Sifry;
if Sifry=nil then Sifry:=SPom else begin
while SPom2^.Next<>nil do SPom2:=SPom2^.Next;
SPom2^.Next:=SPom;
end;
for I:=0 to 1024 do begin // Vymazat heslo
SPom^.Pass[I]:=0;
end;
if CheckBox1.Checked then begin // Pou₧φvß se heslo ???
for I:=1 to Length(Edit5.Text) do // Nejd°φv heslo
SPom^.Pass[I-1]:=Ord(Edit5.Text[I]);
for I:=1 to Length(SHA1(Edit5.Text)) do // Pak SHA-1 hash hesla (kdyby heslo bylo delÜφ ne₧ max. dΘlka klφΦe)
SPom^.Pass[I-1]:=SPom^.Pass[I-1] xor Ord(SHA1(Edit5.Text)[I]);
end;
end;
CloseFile(F3);
HE1:=False;
HE2:=False;
for I:=0 to ((Form1.DCP_sha11.HashSize) div 8)-1 do begin
if Has.Buf[I]<>Has2.Buf[I] then HE1:=True;
if Has.Buf[512+I]<>Has2.Buf[512+I] then HE2:=True;
//Memo1.Lines.Add(IntToStr(Has.Buf[I])+' '+IntToStr(Has2.Buf[I]));
end;
if HE1 then begin
Memo1.Lines.Add('ERROR: Key file damaged !!!');
Application.MessageBox('ERROR: Key file damaged !!!','Error',MB_OK);
end else Memo1.Lines.Add('Key file OK');
if HE2 then begin
Memo1.Lines.Add('ERROR: Crypted file damaged !!!');
Application.MessageBox('ERROR: Crypted file damaged !!!','Error',MB_OK);
end else Memo1.Lines.Add('Crypted file OK');
end; ///////////////////////////////////
// P°enΘst do temp. souboru
S1:=Edit2.Text;S2:=Edit4.Text;
AssignFile(F,S1);Reset(F,1);
AssignFile(F3,S2);Rewrite(F3,1);
while not eof(F) do begin
BlockRead(F,D,LBuf,E3);
BlockWrite(F3,D,E3,E1);
end;
CloseFile(F3);CloseFile(F);
while Sifry<>nil do begin
if FileExists(TempName) then DeleteFile(TempName);
AssignFile(F,S2);Reset(F,1);
AssignFile(F3,TempName);Rewrite(F3,1);
while not eof(F) do begin
BlockRead(F,D,LBuf,E3);
BlockWrite(F3,D,E3,E1);
end;
CloseFile(F3);CloseFile(F);
if FileExists(S2) then DeleteFile(S2);
Sifruj(Sifry,TempName,S2);
SPom:=Sifry^.Next;
Dispose(Sifry);
Sifry:=SPom;
if FileExists(TempName) then DeleteFile(TempName);
end;
Button1.Enabled:=True;
Button5.Enabled:=True;
Button6.Enabled:=True;
CanCrypt;
Memo1.Lines.Add(' ');
end;
procedure TForm1.Button7Click(Sender: TObject);
begin
if SaveDialog2.Execute then Edit4.Text:=SaveDialog2.FileName;
end;
procedure TForm1.Button27Click(Sender: TObject);
begin
ListBox1.Items.Clear;
CanCrypt;
end;
procedure TForm1.Button8Click(Sender: TObject);
begin
Ins(CC[00].Algorithm);
end;
procedure TForm1.Button26Click(Sender: TObject);
var I:LongInt;
begin
for I:=(ListBox1.Count-1) downto 0 do
if ListBox1.Selected[I] then ListBox1.Items.Delete(I);
CanCrypt;
end;
procedure TForm1.Button9Click(Sender: TObject);
begin
Ins(CC[01].Algorithm);
end;
procedure TForm1.Button10Click(Sender: TObject);
begin
Ins(CC[02].Algorithm);
end;
procedure TForm1.Button11Click(Sender: TObject);
begin
Ins(CC[03].Algorithm);
end;
procedure TForm1.Button12Click(Sender: TObject);
begin
Ins(CC[04].Algorithm);
end;
procedure TForm1.Button13Click(Sender: TObject);
begin
Ins(CC[05].Algorithm);
end;
procedure TForm1.Button14Click(Sender: TObject);
begin
Ins(CC[06].Algorithm);
end;
procedure TForm1.Button15Click(Sender: TObject);
begin
Ins(CC[07].Algorithm);
end;
procedure TForm1.Button16Click(Sender: TObject);
begin
Ins(CC[08].Algorithm);
end;
procedure TForm1.Button17Click(Sender: TObject);
begin
Ins(CC[09].Algorithm);
end;
procedure TForm1.Button18Click(Sender: TObject);
begin
Ins(CC[10].Algorithm);
end;
procedure TForm1.Button19Click(Sender: TObject);
begin
Ins(CC[11].Algorithm);
end;
procedure TForm1.Button20Click(Sender: TObject);
begin
Ins(CC[12].Algorithm);
end;
procedure TForm1.Button21Click(Sender: TObject);
begin
Ins(CC[13].Algorithm);
end;
procedure TForm1.Button22Click(Sender: TObject);
begin
Ins(CC[14].Algorithm);
end;
procedure TForm1.Button23Click(Sender: TObject);
begin
Ins(CC[15].Algorithm);
end;
procedure TForm1.Button24Click(Sender: TObject);
begin
Ins(CC[16].Algorithm);
end;
procedure TForm1.Button25Click(Sender: TObject);
begin
Ins(CC[17].Algorithm);
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
Randomized:=False;
Sifry:=nil;
CC[00]:=DCP_blowfish1;
CC[01]:=DCP_cast1281;
CC[02]:=DCP_cast2561;
CC[03]:=DCP_des1;
CC[04]:=DCP_3des1;
CC[05]:=DCP_ice1;
CC[06]:=DCP_thinice1;
CC[07]:=DCP_ice21;
CC[08]:=DCP_idea1;
CC[09]:=DCP_mars1;
CC[10]:=DCP_misty11;
CC[11]:=DCP_rc21;
CC[12]:=DCP_rc51;
CC[13]:=DCP_rc61;
CC[14]:=DCP_rijndael1;
CC[15]:=DCP_serpent1;
CC[16]:=DCP_tea1;
CC[17]:=DCP_twofish1;
Button8 .Caption:=CC[00].Algorithm;
Button9 .Caption:=CC[01].Algorithm;
Button10.Caption:=CC[02].Algorithm;
Button11.Caption:=CC[03].Algorithm;
Button12.Caption:=CC[04].Algorithm;
Button13.Caption:=CC[05].Algorithm;
Button14.Caption:=CC[06].Algorithm;
Button15.Caption:=CC[07].Algorithm;
Button16.Caption:=CC[08].Algorithm;
Button17.Caption:=CC[09].Algorithm;
Button18.Caption:=CC[10].Algorithm;
Button19.Caption:=CC[11].Algorithm;
Button20.Caption:=CC[12].Algorithm;
Button21.Caption:=CC[13].Algorithm;
Button22.Caption:=CC[14].Algorithm;
Button23.Caption:=CC[15].Algorithm;
Button24.Caption:=CC[16].Algorithm;
Button25.Caption:=CC[17].Algorithm;
Ins(CC[14].Algorithm);
Edit5.Enabled:=CheckBox1.Checked;
Label5.Enabled:=CheckBox1.Checked;
CheckBox4.Enabled:=CheckBox1.Checked;
Edit3.Enabled:=CheckBox2.Checked;
Label3.Enabled:=CheckBox2.Checked;
Button4.Enabled:=CheckBox2.Checked;
CanCrypt;
end;
procedure TForm1.CheckBox1Click(Sender: TObject);
begin
Edit5.Enabled:=CheckBox1.Checked;
Label5.Enabled:=CheckBox1.Checked;
CheckBox4.Enabled:=CheckBox1.Checked;
end;
procedure TForm1.CheckBox2Click(Sender: TObject);
begin
Edit3.Enabled:=CheckBox2.Checked;
Label3.Enabled:=CheckBox2.Checked;
Button4.Enabled:=CheckBox2.Checked;
CanCrypt;
end;
procedure TForm1.Button28Click(Sender: TObject);
begin
Memo1.Lines.Clear;
end;
procedure TForm1.CheckBox4Click(Sender: TObject);
begin
if CheckBox4.Checked then Edit5.PasswordChar:=#0 else
Edit5.PasswordChar:='*';
end;
procedure TForm1.Edit1Change(Sender: TObject);
begin
CanCrypt;
end;
procedure TForm1.Edit1Click(Sender: TObject);
begin
CanCrypt;
end;
procedure TForm1.Edit2Change(Sender: TObject);
begin
CanCrypt;
end;
procedure TForm1.Edit4Change(Sender: TObject);
begin
CanCrypt;
end;
procedure TForm1.Edit3Change(Sender: TObject);
begin
CanCrypt;
end;
end.