this slowpoke moves

XOR File Crypter

uses Spin

procedure TForm1.Button1Click(Sender: TObject);
begin
  if OpenDialog1.Execute then
  begin
  Edit1.Text := ExtractFileName(OpenDialog1.FileName);
  button2.Enabled := true;
  end;
end;

procedure TForm1.Button2Click(Sender: TObject);
var
  mem : TMemoryStream;
  i : integer;
  a : byte;
  key : integer;
begin
  mem := TMemoryStream.Create;
  mem.LoadFromfile(OpenDialog1.FileName);
  key := SpinEdit1.Value;       // Schlüsselwert
  try
  for i := 0 to mem.Size -1 do
    begin
    mem.Position := i;
    mem.Read(a, 1);
    a := a xor key;
    inc(key);
    mem.Position := i;
    mem.write(a, 1);
    end;

    mem.SaveToFile( ExtractFilePath(OpenDialog1.FileName) +
                    '_' +
                    ExtractFileName(OpenDialog1.FileName));
    finally
    mem.Free;
  end;
  Beep;
  ShowMessage('Process done.');
end;

Keine Kommentare:

Kommentar veröffentlichen

Beliebte Posts

Translate