erst mal wollte ich sagen ihr habt nettes forum
Ich bin der sumel und 18 jahre.
Ich habe vor ca 4 monaten mit delphi 7 angefangen.
So nun habe ich erste mal heute python geladen und wollte einen decryter source code von delphi 7 nach python um wandeln.
Aber ich schaffe es nicht ,da ich phython wohl keine crypt liberies besitz.
Ich möchte gerne diesen code in einem kleinen gui in python mit euer hilfe ertellen,das ich eine ini laden kann und decrypten kann auch ala stext oder ini anbpeichern kann.
Könnte mir jemand bitte unter die arme greifen und einen source snipsel mit gui zum öfnen und decrypten und als txt speichern coden bzw zeigen.
Ich habe leider keinen schimmer wie das funzt.
Code: Alles auswählen
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DCPcrypt2, DCPrc4, StdCtrls, DCPsha1;
type
TForm9 = class(TForm)
Edit1: TEdit;
Edit2: TEdit;
Button1: TButton;
DCP_rc41: TDCP_rc4;
Button2: TButton;
DCP_sha11: TDCP_sha1;
Edit3: TEdit;
Edit4: TEdit;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
Cipher: TDCP_rc4;
KeyStr: string;
Source, Dest: TFileStream;
begin
KeyStr:= 'der publick key';
// if InputQuery('Passphrase','Enter passphrase',KeyStr) then // get the passphrase
begin
try
Source:= TFileStream.Create(Edit1.Text,fmOpenRead);
Dest:= TFileStream.Create(Edit2.Text,fmCreate);
Cipher:= TDCP_rc4.Create(Self);
Cipher.InitStr(KeyStr,TDCP_sha1); // initialize the cipher with a hash of the passphrase
Cipher.EncryptStream(Source,Dest,Source.Size); // encrypt the contents of the file
Cipher.Burn;
Cipher.Free;
Dest.Free;
Source.Free;
// MessageDlg('File encrypted',mtInformation,[mbOK],0);
except
//MessageDlg('File IO error',mtError,[mbOK],0);
Close;
end;
end;
end;
procedure TForm1.Button2Click(Sender: TObject);
var
Cipher: TDCP_rc4;
KeyStr: string;
Source, Dest: TFileStream;
begin
KeyStr:= 'der publick key';
//if InputQuery('Passphrase','Enter passphrase',KeyStr) then // get the passphrase
begin
try
Source:= TFileStream.Create(Edit3.Text,fmOpenRead);
Dest:= TFileStream.Create(Edit4.Text,fmCreate);
Cipher:= TDCP_rc4.Create(Self);
Cipher.InitStr(KeyStr,TDCP_sha1); // initialize the cipher with a hash of the passphrase
Cipher.DecryptStream(Source,Dest,Source.Size); // decrypt the contents of the file
Cipher.Burn;
Cipher.Free;
Dest.Free;
Source.Free;
//MessageDlg('File decrypted',mtInformation,[mbOK],0);
except
//MessageDlg('File IO error',mtError,[mbOK],0);
Close;
end;
end;
end;
end.