我有以下的ActionScript代码:
function EncryptString(SrcStr:String, KeyStr:String) : String
{
var KeyHexed:* = Hex.toArray(Hex.fromString(KeyStr));
var SrcHexed:* = Hex.toArray(Hex.fromString(SrcStr));
var NullPadded:* = new NullPad();
var Cipher:* = Crypto.getCipher("simple-aes128-cfb8", KeyHexed, NullPadded);
NullPadded.setBlockSize(Cipher.getBlockSize());
Cipher.encrypt(SrcHexed);
return Base64.encodeByteArray(SrcHexed);
}
我如何使用Delphi Encryption Compendium (DEC)进行转换到Delphi?
谢谢你的帮助!
编辑1:
我尝试了以下Delphi代码:
function EncryptString(Param1, Param2: String): String;
var
Cipher: TCipher_Rijndael;
begin
Cipher := TCipher_Rijndael.Create;
Cipher.Mode := cmCFB8;
Cipher.Init(Param2, '', $FF);
Result := Cipher.EncodeBinary(TFormat_HEX.Encode(Param1), TFormat_MIME64);
Cipher.Free;
end;
AnsiString
而不是String
。 - Warren P