Solved

Encrypt String!

Posted on 2000-03-13
6
353 Views
Last Modified: 2010-04-04
How to SIMPLY encrypt/decrypt strings in Memo1 when the user is saving/loading the file?
0
Comment
Question by:pipigril
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 

Author Comment

by:pipigril
ID: 2612622
I forget to say that the file is in "plain text" format.
0
 
LVL 5

Expert Comment

by:TheNeil
ID: 2612659
Just do this to input the data:

AssignFile(data_in, <Filename>);
Reset(data_in);
Memo1.Lines.Clear;
WHILE NOT(EOF(data_in))
DO
BEGIN
  READLN(data_in, sTemp);
  sTemp := DecodeStr(sTemp);
  Memo1.Lines.Add(sTemp);
END;
CloseFile(data_in);

And then to output the data:

AssignFile(data_out, <Filename>);
Rewrite(data_out);
FOR iCount := 0 TO (memo1.Lines.Count - 1)
DO
BEGIN
  sTemp := Memo1.Lines[iCount];
  sTemp := DecodeStr(sTemp);
  WRITELN(data_out, sTemp);
END;
CloseFile(data_out);

You'll need to create an encode and a decode routine which have a strings passed to them and then either encode or decode them. Writing these depends on how secure you want to make them. If you want help with these then just ask

The Neil
0
 
LVL 1

Expert Comment

by:umulig
ID: 2612737
You can find a lot of this stuff on WWW.TORRY.RU

Regards
Umulig
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 2

Accepted Solution

by:
Serega earned 200 total points
ID: 2613198
There is no case what text format you are using.
You should to decode and encode whole memo text, for example as following:
// simple coding
// encoding and saving to file
var str: String;
    i:integer;
begin
     str := Memo1.Text;
     for i:=1 to length(str) do                {for all characters in string }
       str[i] := chr(ord(str[i]) xor 123);   {code character}
     Memo1.Text := str;
     Memo1.Lines.SaveToFile('e:\temp\file.txt');
     Memo1.Clear;
end;

With that coding, decoding procedure will be the same.
0
 
LVL 13

Expert Comment

by:Epsylon
ID: 2613373
0
 
LVL 13

Expert Comment

by:Epsylon
ID: 2619321
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question