Retrieving data from an encrypted text file?

Posted by user on Stack Overflow See other posts from Stack Overflow or by user
Published on 2010-12-23T03:44:13Z Indexed on 2010/12/23 3:54 UTC
Read the original article Hit count: 214

Filed under:
|
|

Let's say I have a text file contains my data.

data :
ab
bc
de

-

encrypted data on text file :
ba
cb
ed

I want to find bc from text file, so I have to decrypt the text file with this code :

SL:=TStringList.create;
SL.LoadFromFile(textfile)

SLtemp:=TStringList.create;

for I := 0 to SL.Count - 1 do
SLtemp.Add(ReverseString(SL[i])); //decrypt

SL.Free;

for I := 0 to SLtemp.Count - 1 do
if SLtemp[i] = 'bc' then
begin
showmessage('found');
break;
end;
SLtemp.Free;

I think my way is wasting resources. I have to load whole file to memory and decrypt them. I need some suggestions here to find quickly a specific line from an encrypted text.

Thanks.

© Stack Overflow or respective owner

Related posts about delphi

Related posts about encryption