Delphi-Quellcode:
function HexStringToStr(s : string):string;
begin
if s = '' then
Result := ''
else
begin
if Odd(length(s)) then
s := '0'+s;
SetLength(Result, Length(s) div 2);
HexToBin(Pchar(s), PChar(Result), Length(Result));
end;
end;
procedure TfMain.BtOpenClick(Sender: TObject);
Var w:Word;
Crypt: String;
begin
w:=16518;
OpenDialog1.Execute;
RegInfo.LoadFromFile(OpenDialog1.FileName);
Crypt:=RegInfo.Text;
EdShowInfo.Text:=Decrypt(HexStringToStr(Crypt),w);// load decryptet from Base16
end;
und
Delphi-Quellcode:
function StrToHexString(const s : string):string;
begin
if s = '' then
Result := ''
else
begin
SetLength(Result, Length(s)*2);
BinToHex(PChar(s), PChar(Result), Length(s));
end;
end;
procedure TfMain.SaveEncrypted(Sender: TObject);
Var InformationText: TStringList;
w:Word;
Crypt:String;
begin
fMain.Visible:=false;
w:= 16518;
InformationText:=TstringList.Create();
Crypt:=StrToHexString(Encrypt(CreateRegInfo,w)); // Save encrypted as Base16
InformationText.Add(Crypt);
InformationText.SaveToFile(ExtractFilePath(ParamStr(0))+'reg_info.dat');
end;
jetzt bekomme ich einen halb richtig entschlüsselten string
edit: irgendwo ist noch der wurm drinne ^^
danke für die antworten