Link to home
Start Free TrialLog in
Avatar of pipigril
pipigril

asked on

Encrypt String!

How to SIMPLY encrypt/decrypt strings in Memo1 when the user is saving/loading the file?
Avatar of pipigril
pipigril

ASKER

I forget to say that the file is in "plain text" format.
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
You can find a lot of this stuff on WWW.TORRY.RU

Regards
Umulig
ASKER CERTIFIED SOLUTION
Avatar of Serega
Serega
Flag of Belarus image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial