Thema: Delphi Dateien verschlüsseln

Einzelnen Beitrag anzeigen

Benutzerbild von idontwantaname
idontwantaname

Registriert seit: 31. Aug 2004
Ort: Traiskirchen
575 Beiträge
 
Turbo Delphi für Win32
 

Re: Dateien verschlüsseln

  Alt 8. Mai 2005, 17:42
wie wärs mit xor ??

Delphi-Quellcode:
function XORCrypt(Password,InputFilePath,OutputFilePath:String):Boolean;
var aktChar: Integer;
   InputFile, OutputFile: File of Byte;
   Buffer:Byte;
begin
  Result := False;

  try
    aktChar := 1;

    AssignFile(InputFile,InputFilePath);
    Reset(InputFile);

    AssignFile(OutputFile,OutputFilePath);
    Rewrite(OutputFile);

    while not Eof(InputFile) do
    begin
      if(aktChar > Length(Password)) then aktChar := 1;
      Read(InputFile,Buffer);
      Buffer := Buffer xor ord(Password[aktChar]);
      Write(OutputFile,Buffer);
      Inc(aktChar);
      Application.ProcessMessages;
    end;
  finally
    CloseFile(InputFile);
    CloseFile(OutputFile);

    Result := True;
  end;
end;
Oliver Hanappi
Besucht meine neue Homepage: http://oli.hux.de
  Mit Zitat antworten Zitat