文件名称:最新AES的CBC加解密dll
文件大小:583KB
文件格式:DLL
更新时间:2022-07-23 11:41:18
AES CBC 加密
function AESCBCNew(kb: integer; resStr: PChar; inKey: PChar; initVector: PChar; OutStr: Pchar): Boolean; cdecl; external 'AES.dll'; function AESCBCD(kb: integer; resStr: PChar; inKey: PChar; initVector: PChar; OutStr: Pchar): Boolean; cdecl; external 'AES.dll'; procedure TForm1.Button1Click(Sender: TObject); function WideStringToUTF8(const S: WideString): AnsiString; begin Result := UTF8Encode(S); end; var tmpPchar, sKey, sVector: PChar; begin sKey :=PChar(edit1.text); sVector := PChar(leftstr(edit1.text, 16)); GetMem(tmpPchar, 1024); if AESCBCNew(256,PChar(edit2.text), sKey, sVector, tmpPchar) then begin edit3.text := tmpPchar; end; FreeMem(tmpPchar); end; procedure TForm1.Button2Click(Sender: TObject); var tmpPchar, sKey, sVector: PChar; begin sKey :=PChar(edit1.text); sVector := PChar(leftstr(edit1.text, 16)); GetMem(tmpPchar, 1024); if AESCBCD(256,PChar(edit3.text), sKey, sVector, tmpPchar) then begin edit2.text := Trim(tmpPchar); end; FreeMem(tmpPchar); end;