Einzelnen Beitrag anzeigen

EDatabaseError

Registriert seit: 11. Mai 2005
Ort: Göppingen
1.238 Beiträge
 
Delphi 2007 Professional
 
#1

Fehler bei XOR-Verschlüsslung?

  Alt 21. Aug 2006, 15:16
Ich habe folgenden Code:
Delphi-Quellcode:
function SimpleCryptString(const S, Key: string): string;
var
  i, j: Integer;
  C: Byte;
  P: PByte;
begin
  SetLength(Result, Length(S));
  P := PByte(Result);

  j := 1;
  for i := 1 to Length(S) do
  begin
    C := Ord(S[i]);

    C := C xor Ord(Key[j]);
    P^ := C;
    Inc(P);
    Inc(j);
    if j > Length(Key) then
      j := 1;
  end;
end;
der einen String verschlüsselt. Leider wird das - und alles was darauf folgt verschluckt??? Warum?

Bspw: Ich will test-test.de verschlüsseln.
Wenn ich das Resultat wieder entschlüssle bekomme ich folgendes test

Danke

Mfg
Tobi
Tobias
It's not a bug, it's a feature.
  Mit Zitat antworten Zitat