unit U_Codieren2;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Menus, StdCtrls, Buttons, ExtCtrls;
type
TForm1 =
class(TForm)
Memo1: TMemo;
MainMenu1: TMainMenu;
Datei1: TMenuItem;
Neu1: TMenuItem;
ffnen1: TMenuItem;
Speicherals1: TMenuItem;
Schlieen1: TMenuItem;
OpenDialog1: TOpenDialog;
SaveDialog1: TSaveDialog;
Hilfe1: TMenuItem;
Info1: TMenuItem;
Btn_Codieren: TBitBtn;
E_Passwort: TLabeledEdit;
procedure Schlieen1Click(Sender: TObject);
procedure Neu1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure ffnen1Click(Sender: TObject);
procedure Speicherals1Click(Sender: TObject);
procedure Info1Click(Sender: TObject);
procedure Btn_CodierenClick(Sender: TObject);
private
Arbeit:
Array [0..1000]
of byte;
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Schlieen1Click(Sender: TObject);
begin
close;
end;
procedure TForm1.Neu1Click(Sender: TObject);
begin
Memo1.Clear;
E_Passwort.Clear;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
Memo1.Clear;
E_Passwort.Clear;
end;
procedure TForm1.ffnen1Click(Sender: TObject);
begin
if(OpenDialog1.Execute)
then Memo1.Lines.LoadFromFile(OpenDialog1.FileName);
end;
procedure TForm1.Speicherals1Click(Sender: TObject);
begin
if SaveDialog1.Execute
then Memo1.Lines.SaveToFile(SaveDialog1.FileName);
end;
procedure TForm1.Info1Click(Sender: TObject);
begin
//
end;
procedure TForm1.Btn_CodierenClick(Sender: TObject);
var
V_Text, V_Passwort:
string;
i, step,d:Integer;
begin
d:=0;
V_Passwort:=E_Passwort.Text;
V_Text:=Memo1.Text;
for i:=1
to length(V_Text)
do
begin
step:=Ord(V_Passwort[d]);
d:=d+1;
if d>length(V_Passwort)
then d:=1;
V_Text[i]:=char(step
XOR Ord(V_Text[i]));
Memo1.Text:=V_Text;
end;
end;
end.