this slowpoke moves

RC4 String Crypter

 Download DCPCrypt2 Component : https://github.com/Dunhamb4a/DcPCryptV2

Beispiel :
uses DCPrc4, DCPsha1

var
  KeyStr: string;

//

procedure TForm1.Button1Click(Sender: TObject);
var
   Cipher: TDCP_rc4;
   Source, Dest: TFileStream;
 begin
   //if InputQuery('Passphrase','Enter passphrase',KeyStr) then  // get the passphrase
   begin
     try
       Source:= TFileStream.Create(Edit1.Text,fmOpenRead);   // Edit1.Text, PATH SOURCE OF FILE
       Dest:= TFileStream.Create(Edit2.Text,fmCreate);       // Edit2.Text, PATH DESTINATION OF FILE
       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);
     end;
   end;
 end;
 
procedure TForm1.Button2Click(Sender: TObject);
var
    Cipher: TDCP_rc4;
    //KeyStr: string;
    Source, Dest: TFileStream;
  begin
    //if InputQuery('Passphrase','Enter passphrase',KeyStr) then  // get the passphrase
    begin
      try
        Source:= TFileStream.Create(Edit1.Text,fmOpenRead);   // Edit1.Text, PATH SOURCE OF FILE
        Dest:= TFileStream.Create(Edit2.Text,fmCreate);       // Edit2.Text, PATH DESTINATION OF FILE
        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);
      end;
    end;
  end;
 
procedure TForm1.FormCreate(Sender: TObject);
begin
  KeyStr         := 'hackbard';     // my password
end;

Keine Kommentare:

Kommentar veröffentlichen

Beliebte Posts

Translate