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
Speicher:
Array 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.Btn_CodierenClick(Sender: TObject);
var
V_Passwort:
string;
i, step,d,N,len:Integer;
begin
d:=0;
V_Passwort:=E_Passwort.Text;
len:=length(Memo1.Text);
getmem(speicher,len);
FOR N:=0
TO len
DO
begin
Speicher[N]:=ord(Memo1.Text[N])
end;
FOR i:=1
TO len
DO
begin
step:=Ord(V_Passwort[d]);
d:=d+1;
if d>length(V_Passwort)
then d:=1;
end;
FOR N:=1
TO len
DO
begin
Speicher[i]:=step
XOR Speicher[i];
end;
end;
end.