Autor Beitrag
Jeremy
ontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 99

Fedora Core 1
K3 Ent
BeitragVerfasst: Mi 08.10.03 16:01 
Hallo Alle,
Kann Jemand mir mal sagen warum der folgende code
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
procedure TForm1.Button1Click(Sender: TObject);
 Var
   a, space, Breite: Integer;
   Cipher: TDCP_twofish;
   KeyString: String;
begin
 Breite := Memo1.Lines.Count - 1;
 space := Length(Memo1.Lines[1]) DIV 2;
 KeyString := Copy(Memo1.Lines[0], space, 1);
 Cipher := TDCP_twofish.Create(Self);
 Cipher.InitStr(KeyString, TDCP_tiger);
 for a := 0  to Breite do
  begin
   Memo1.Lines[a] := Cipher.EncryptString(Memo1.Lines[a]);
   Cipher.Burn;
   Cipher.Free;
  end;
end;

Nur Memo1.Lines[0] Verschlüsselt und dann folgende Exception Auslöst:
ProjectName.exe Raised EExternalException with message External Exception 'C000001E' .

Wo Liegt der fehler??

Danke im Vorraus

Jeremy

_________________
Jede ende hat ne anfang genau wie umgekehrt und windows ist der teurste mull den man kaufen kann!!!
obbschtkuche
Gast
Erhaltene Danke: 1



BeitragVerfasst: Mi 08.10.03 16:05 
ausblenden Delphi-Quelltext
1:
Cipher.Free;					


weil du dein Objekt freigibst und danach versuchst darauf zuzugreifen
Jeremy Threadstarter
ontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 99

Fedora Core 1
K3 Ent
BeitragVerfasst: Mi 08.10.03 16:26 
Danke schient immer die kleinigkeiten zu sein das man immer übersieht!!

Naja Danke nochmal

_________________
Jede ende hat ne anfang genau wie umgekehrt und windows ist der teurste mull den man kaufen kann!!!
Tino
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Veteran
Beiträge: 9839
Erhaltene Danke: 45

Windows 8.1
Delphi XE4
BeitragVerfasst: Do 09.10.03 09:22 
Zeig doch mal wie dein Code jetzt aussieht! Danke!

Gruß
Tino
Jeremy Threadstarter
ontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 99

Fedora Core 1
K3 Ent
BeitragVerfasst: Do 09.10.03 16:11 
Titel: Verschlüsselungs Probleme
Ok hier ist mal der code, iist aber noch lange nicht perfekt!!
ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
unit UnitCryptMessage;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, DCPcrypt2, DCPtiger, DCPblockciphers, DCPtwofish, StdCtrls;

type
  TForm1 = class(TForm)
    Memo1: TMemo;
    Button1: TButton;
    Button2: TButton;
    DCP_twofish1: TDCP_twofish;
    DCP_tiger1: TDCP_tiger;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
 Var
   a, space, Breite, LtoSet: Integer;
   Cipher: TDCP_twofish;
   KeyString: Array of String;
begin
 LtoSet := Memo1.Lines.Count;
 setlength(KeyString, LtoSet);
 Breite := Memo1.Lines.Count - 1;
 space := Length(Memo1.Lines[1]) DIV 2;
for a:=0 to Breite - 1 do
 begin
 KeyString[a] := Copy(Memo1.Lines[0], space, 1);
 end;
 Cipher := TDCP_twofish.Create(Self);
 for a := 0  to Breite do
  begin
   Cipher.InitStr(KeyString[a], TDCP_tiger);
   Memo1.Lines[a] := KeyString[a] + Cipher.EncryptString(Memo1.Lines[a]);
  end;
Cipher.Burn;
Cipher.Free;
end;
procedure TForm1.Button2Click(Sender: TObject);
var
a, space, Breite, LtoSet: Integer;
   Cipher: TDCP_twofish;
   KeyString: Array of String;
begin
LtoSet := Memo1.Lines.Count;
setlength(KeyString, LtoSet);
Breite := Memo1.Lines.Count - 1;
for a:=0 to Breite do
 begin
  KeyString[a] := copy(Memo1.Lines[a], 1, 0);
 end;
Cipher := TDCP_twofish.Create(Self);
 for a:= 0 to Breite do
  begin
   Cipher.InitStr(KeyString[a], TDCP_tiger);
   Memo1.Lines[a] := KeyString[a] + Cipher.DecryptString(Memo1.Lines[a]);
  end;
 Cipher.Burn;
 Cipher.Free;
end;

end.

_________________
Jede ende hat ne anfang genau wie umgekehrt und windows ist der teurste mull den man kaufen kann!!!