Autor Beitrag
Julian W.
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 47

Win 2000
D7 Enterprise
BeitragVerfasst: Mo 18.09.06 15:40 
Hallo leute!
Ich würde gerne einen DES-String entschlüsseln.. Ich habe mir dazu DCPcrypt bei Torrys gezogen, aber wenn ich jetzt einen Sting entschlüsseln/verschlüsseln will, kommt da ne Fehlermeldung dcp_des wurde nicht initialisiert. Also habe ich mal in der Hilfe nachgeschaut und da ist ein Beispiel zu rc4. Naja, da wird das irgendwie mit TDCP_sha1 initialisiert, was ich nicht verstehe, da sha1 ja auch ne verschlüsselungsmethode ist.. Ich kann ja mal den Beispiel Code posten, vielleicht kann ja jemand was damit anfangen..

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
  procedure TForm1.btnEncryptClick(Sender: TObject);
  var
    i: integer;
    Cipher: TDCP_rc4;
    KeyStr: string;
  begin
    KeyStr:= '';
    if InputQuery('Passphrase','Enter passphrase',KeyStr) then  // get the passphrase
    begin
      Cipher:= TDCP_rc4.Create(Self);
      Cipher.InitStr(KeyStr,TDCP_sha1);         // initialize the cipher with a hash of the passphrase
      for i:= 0 to Memo1.Lines.Count-1 do       // encrypt the contents of the memo
        Memo1.Lines[i]:= Cipher.EncryptString(Memo1.Lines[i]);
      Cipher.Burn;
      Cipher.Free;
    end;
  end;

(*DCPcrypt is copyrighted © 1999-2002 David Barton.
All trademarks are property of their respective owners.*)


MfG Julian
TheWhitePhoenix
Hält's aus hier
Beiträge: 13

Linux, Win 2000 Server, Win XP Pro
D2 Std, D2 C/S, D6 Pers, D2005 Pers
BeitragVerfasst: Mi 20.09.06 14:02 
Titel: RE: DES Verschlüsselung - DCPcrypt
Hallo,

SHA ist keine Verschlüsselung sondern ein Hash-Summen verfahren...

auf dein beispiel bezogen würde das dann etwa so aus sehen:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
 procedure TForm1.btnEncryptClick(Sender: TObject);
  var
    i: integer;
    Cipher: TDCP_des;
    KeyStr: string;
  begin
    KeyStr:= '';
    if InputQuery('Passphrase','Enter passphrase',KeyStr) then  // get the passphrase
    begin
      Cipher:= TDCP_des.Create(Self);
      Cipher.InitStr(KeyStr,TDCP_sha1);         // initialize the cipher with a hash of the passphrase
      for i:= 0 to Memo1.Lines.Count-1 do       // encrypt the contents of the memo
        Memo1.Lines[i]:= Cipher.EncryptString(Memo1.Lines[i]);
      Cipher.Burn;
      Cipher.Free;
    end;
  end;

(*DCPcrypt is copyrighted © 1999-2002 David Barton.
All trademarks are property of their respective owners.*)
Julian W. Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 47

Win 2000
D7 Enterprise
BeitragVerfasst: Fr 29.09.06 22:52 
Mhm, ok, aber woher weiß ich, mit welchem Hash-Summen Verfahren ich das jetzt entschlüsseln muss? Also den 'Key' weiß ich, das ist immer die Drive-ID... Ich glaub, ich versteh da grad was nich xD Help wär n1