Thema: Delphi Delphi Entschlüsselung

Einzelnen Beitrag anzeigen

Master-of-nichts

Registriert seit: 30. Nov 2006
Ort: zuhause
5 Beiträge
 
#6

Re: Delphi Entschlüsselung

  Alt 7. Dez 2006, 12:29
Delphi-Quellcode:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  Grids, StdCtrls;

type
  TForm1 = class(TForm)
    StringGrid1: TStringGrid;
    Button1: TButton;
    Button2: TButton;
    Button3: TButton;
    Button4: TButton;
    Memo1: TMemo;
    Memo2: TMemo;
    Edit1: TEdit;
    Button5: TButton;
    Button6: TButton;
    procedure FormCreate(Sender: TObject);
    procedure Button3Click(Sender: TObject);
    procedure Button4Click(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);

  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}
var n,k,sch_wort_lang: integer;
    sch_wort,buchstabe,klartext,geheimtext : string;

procedure TForm1.FormCreate(Sender: TObject);
begin
stringgrid1.Cells[0,0]:='Klartextalphabet';
stringgrid1.cells[1,0]:='Geheimtextalphabet';
stringgrid1.Cells[0,1]:='A';
stringgrid1.Cells[0,2]:='B';
stringgrid1.cells[0,3]:='C';
stringgrid1.Cells[0,4]:='D';
stringgrid1.cells[0,5]:='E';
stringgrid1.Cells[0,6]:='F';
stringgrid1.Cells[0,7]:='G';
stringgrid1.Cells[0,8]:='H';
stringgrid1.Cells[0,9]:='I';
stringgrid1.cells[0,10]:='J';
stringgrid1.Cells[0,11]:='K';
stringgrid1.Cells[0,12]:='L';
stringgrid1.Cells[0,13]:='M';
stringgrid1.Cells[0,14]:='N';
stringgrid1.Cells[0,15]:='O';
stringgrid1.Cells[0,16]:='P';
stringgrid1.Cells[0,17]:='Q';
stringgrid1.Cells[0,18]:='R';
stringgrid1.Cells[0,19]:='S';
stringgrid1.Cells[0,20]:='T';
stringgrid1.Cells[0,21]:='U';
stringgrid1.Cells[0,22]:='V';
stringgrid1.Cells[0,23]:='W';
stringgrid1.Cells[0,24]:='X';
stringgrid1.Cells[0,25]:='Y';
stringgrid1.Cells[0,26]:='Z';

stringgrid1.Cells[1,1]:='G';
stringgrid1.Cells[1,2]:='O';
stringgrid1.cells[1,3]:='L';
stringgrid1.Cells[1,4]:='D';
stringgrid1.cells[1,5]:='E';
stringgrid1.Cells[1,6]:='N';
stringgrid1.Cells[1,7]:='B';
stringgrid1.Cells[1,8]:='R';
stringgrid1.Cells[1,9]:='U';
stringgrid1.cells[1,10]:='F';
stringgrid1.Cells[1,11]:='S';
stringgrid1.Cells[1,12]:='K';
stringgrid1.Cells[1,13]:='A';
stringgrid1.Cells[1,14]:='C';
stringgrid1.Cells[1,15]:='H';
stringgrid1.Cells[1,16]:='I';
stringgrid1.Cells[1,17]:='J';
stringgrid1.Cells[1,18]:='M';
stringgrid1.Cells[1,19]:='P';
stringgrid1.Cells[1,20]:='Q';
stringgrid1.Cells[1,21]:='U';
stringgrid1.Cells[1,22]:='V';
stringgrid1.Cells[1,23]:='W';
stringgrid1.Cells[1,24]:='X';
stringgrid1.Cells[1,25]:='Y';
stringgrid1.Cells[1,26]:='Z';
for n:=1 to 26 do stringgrid1.cells[0,n]:= chr(n+64);
end;

procedure TForm1.Button3Click(Sender: TObject); //Schlüssel erzeugen
begin
//
end;

procedure TForm1.Button4Click(Sender: TObject); //vereinfachen
begin
sch_wort := edit1.text;
sch_wort_lang := length(sch_wort); //Grossbuchstaben
for n:=1 to sch_wort_lang do sch_wort[n]:= upcase(sch_wort[n]);
n:=0;
repeat //Sonderzeichen raus
      n:=n+1;
      if not(sch_wort[n] in['A'..'Z']) then
        begin
        sch_wort := copy(sch_wort,1,n-1)+ copy(sch_wort,n+1,99);
        n:=n-1;
        sch_wort_lang := sch_wort_lang -1;
        end;
      until n>sch_wort_lang;
n:=0;
repeat //Doubletten raus
      n:=n+1;
      buchstabe := sch_wort[n];
      for k:=n+1 to sch_wort_lang do
          if sch_wort[k]=buchstabe then
             sch_wort := copy(sch_wort,1,k-1)+ copy(sch_wort,k+1,99);
      until n>sch_wort_lang;
edit1.text := sch_wort;
end;

procedure TForm1.Button1Click(Sender: TObject); //verschlüsseln
begin
//
end;





procedure TForm1.Button2Click(Sender: TObject); //entschlüsseln
begin

end;

end.

end.
Master-of-nichts

[edit=Christian Seehase]Delphi-Tags gesetzt. Bitte künftig selber machen. Danke. Mfg, Christian Seehase[/edit]
  Mit Zitat antworten Zitat