Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Encrypt String!

Posted on 2000-03-13
6
Medium Priority
?
357 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 800 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

Technology Partners: 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!

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…

670 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