RTC Forums
November 24, 2024, 01:44:48 PM
Welcome,
Guest
. Please
login
or
register
.
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
Home
Help
Login
Register
RTC Forums
>
Subscription
>
Support
>
encryption
Pages: [
1
]
« previous
next »
Print
Author
Topic: encryption (Read 4490 times)
Ronald van Tour
RTC License++
Posts: 37
encryption
«
on:
October 30, 2013, 04:00:06 PM »
I have a memo and 2 buttons and below code.
When I decrypt I get not all data back. Only a few lines.
procedure TForm2.Button1Click(Sender: TObject);
var A:ansistring;
begin
A:=(memo1.lines.Text);
Crypt(A,'12994');
memo1.Text:=(A);
end;
procedure TForm2.Button2Click(Sender: TObject);
var A:ansistring;
begin
A:=(memo1.lines.Text);
DeCrypt(A,'12994');
memo1.Text:=(A);
end;
Logged
D.Tkalcec (RTC)
Administrator
Posts: 1881
Re: encryption
«
Reply #1 on:
October 30, 2013, 04:48:23 PM »
TMemo component from Delphi does NOT have the capability for storing binary content. It is only for Text. Once you use Crypt, you will no longer have pure Text. You will have binary content. Also, when using Delphi 2009 and later, TMemo can contain Unicode characters, which need to be encoded to 8-bit characters before they can be passed to the Crypt function, and decoded back to Unicode after using Decrypt.
For example, like this:
uses rtcInfo,rtcCrypt;
procedure TForm2.Button1Click(Sender: TObject);
var A:
RtcString
;
begin
A:=
Utf8Encode
(memo1.lines.Text);
Crypt(A,'12994');
Write_File
('crypt.txt',A);
end;
procedure TForm2.Button2Click(Sender: TObject);
var A:
RtcString
;
begin
A:=
Read_File
('crypt.txt');
DeCrypt(A,'12994');
memo1.Text:=
Utf8Decode
(A);
end;
Best Regards,
Danijel Tkalcec
Logged
Ronald van Tour
RTC License++
Posts: 37
Re: encryption
«
Reply #2 on:
October 31, 2013, 09:29:12 AM »
Thank you.
My version of RTC needs the ansistring as input.
But it works!
Logged
Pages: [
1
]
Print
« previous
next »
Jump to:
Please select a destination:
-----------------------------
Dashboard
-----------------------------
=> General
=> 3rd-Party
=> Quick Start
-----------------------------
Subscription
-----------------------------
=> Support
Loading...