Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var
- Codec: TCodec;
- CL: TCryptographicLibrary;
- PlainStream: TStringStream;
- CipherStream: TMemoryStream;
- begin
- PlainStream := TStringStream.Create(Edit1.Text);
- CipherStream := TMemoryStream.Create;
- CL := TCryptographicLibrary.Create(nil);
- Codec := TCodec.Create(nil);
- Codec.CryptoLibrary := CL;
- Codec.ChainModeId := uTPLb_Constants.CBC_ProgId;
- Codec.StreamCipherId := uTPLb_Constants.BlockCipher_ProgId;
- Codec.BlockCipherId := Format(uTPLb_Constants.AES_ProgId, [256]);
- Codec.Password := Edit3.Text;
- Codec.EncryptStream(PlainStream, CipherStream);
- Codec.Burn;
- Memo1.Text := Stream_to_Base64(CipherStream);
- Memo2.Clear;
- Memo2.Lines.Add(Format('Size: %d bytes', [CipherStream.Size]));
- Memo2.Lines.Add(Format('Original size: %d bytes', [PlainStream.Size]));
- Codec.Free;
- CL.Free;
- CipherStream.Free;
- PlainStream.Free;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement