Advertisement
Guest User

Untitled

a guest
Jun 17th, 2018
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 0.84 KB | None | 0 0
  1. function EncryptText_AES_128(input: string; password: string): ansistring;
  2. var
  3.   Codec: TCodec;
  4.   CipherText: String;
  5. begin
  6.   Codec := TCodec.Create(nil);
  7.   try
  8.     Codec.CryptoLibrary := TCryptographicLibrary.Create(Codec);
  9.     //
  10.     Codec.StreamCipherId := BlockCipher_ProgID;
  11.     Codec.BlockCipherId := Format(AES_ProgId, [128]);
  12.     Codec.ChainModeId := ecb_ProgId;
  13.     //
  14.     Codec.Password := Password;
  15.     Codec.EncryptString(input, CipherText,tencoding.UTF8);
  16.     //
  17.     Result := (CipherText);
  18.   finally
  19.     Codec.Free;
  20.   end;
  21. end;
  22. procedure TForm1.Button2Click(Sender: TObject);
  23. begin
  24. memo1.Lines.Add( EncryptText_AES_128(#$00#$01#$02#$03#$04#$05#$06#$07#$08#$09#$0a#$0b#$0c#$0d#$0e#$0f,#$78#$34#$90#$fd#$6a#$6c#$90#$f0#$72#$36#$a8#$ed#$40#$27#$94#$f8#$73#$2c#$96#$fb#$71#$1f#$a0#$f4#$6c#$34#$9a#$c4#$79#$24#$93#$e8));
  25. end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement