Einzelnen Beitrag anzeigen

Schorschi5566

Registriert seit: 6. Feb 2006
197 Beiträge
 
Delphi 10.2 Tokyo Enterprise
 
#20

AW: Portierungsproblem mit Assembler, Register

  Alt 16. Jun 2011, 20:43
Hmm, für Win32 läuft's schonmal mit Lazarus. Dabei kommt offenbar die PIC-Problematik nicht zum Tragen.

Trotzdem, war einfacher als gedacht.

@Hagen: Hast du ein Testprogramm womit man mal weite Teile der DEC ausprobieren kann, oder so? Ich habe nur mal schnell einen Encrypt/Decrypt-Versuch gemacht, der funktioniert. Auch mit unter Delphi codierten Strings.

Das hat geklappt:
Delphi-Quellcode:
function EncryptString(const Password: RawByteString;
  const Value: RawByteString): RawByteString;
var
  Salt, SessionKey: Binary;
begin
  Salt := RandomBinary(16);
  with TCipher_Rijndael.Create do
    try
      SessionKey := THash_SHA1.KDFx(Password, Salt, Context.KeySize,
        TFormat_Copy);
      mode := cmCFS8; // ein 8Bit Feedback Modus ist für kurze Datenmengen sicherer
      Init(SessionKey);
      result := TFormat_MIME64.Encode(Salt + EncodeBinary(Value, TFormat_Copy));
    finally
      Free;
      ProtectBinary(Salt);
      ProtectBinary(SessionKey);
    end;
end;
Uwe
"Real programmers can write assembly code in any language." - Larry Wall
Delphi programming rocks
  Mit Zitat antworten Zitat