Solved

Encrypt String!

Posted on 2000-03-13
6
348 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
6 Comments
 

Author Comment

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

Expert Comment

by:TheNeil
Comment Utility
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
Comment Utility
You can find a lot of this stuff on WWW.TORRY.RU

Regards
Umulig
0
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 
LVL 2

Accepted Solution

by:
Serega earned 200 total points
Comment Utility
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
Comment Utility
0
 
LVL 13

Expert Comment

by:Epsylon
Comment Utility
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

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…
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…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

743 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now