RE: String encryption
"Andre du Plessis" <[email protected]> Mon, 18 Aug 2003 14:34:05 +0200
| Newsgroups | gmane.comp.lang.delphi.programming |
|---|---|
| Message-ID | <001d01c36585$03a16370$2f3da8c0@ANDRE> |
I would also recommend dcpcrypt : http://www.scramdisk.clara.net/
Turbopower is obviously good, I use it mainly for the RSA public private
key encryption which is not available as open source anywhere else, but
Turbopower does not enclude twofish which is the successor of blowfish
and MUCH MUCH faster,
The fact that the source is for D5 does not matter it compiles and works
fine on D6 & D7, it is not platform specific code since it is
algorithmic,
Here is a short snippet that will encrypt a string, remember you have to
convert the encrypted result to base64 if you want it to be printable
characters, or string compatible characters, but this will increase the
size a bit.
You need TwoFish and Base64 in your uses clause.
function EncryptString(const S: string; Key: string): string;
var
lCrypt : TDCP_TwoFish;
begin
lCrypt := TDCP_TwoFish.Create(nil);
try
lCrypt.InitStr(Key);
Setlength(result, length(S));
lCrypt.EncryptCFB(S[1], result[1], length(S));
Result := B64Encode(Result);
finally
lCrypt.Free;
end;
end;
function DecryptString(const S: string; Key: string): string;
var
lCrypt : TDCP_TwoFish;
begin
lCrypt := TDCP_TwoFish.Create(nil);
try
lCrypt.InitStr(Key);
Result := B64Decode(S);
lCrypt.DecryptCFB(Result[1], result[1], length(Result));
finally
lCrypt.Free;
end;
end;
-----Original Message-----
From: Jatin N. Bhoir [mailto:[email protected]]
Sent: Monday, August 18, 2003 1:50 PM
To: [email protected]
Subject: Re: [Delphi] String encryption
I used DCPCrypt, 2 years back. DCPCrypt was on my mind. But Torry's site
is
not updated and it mentions that DCPCrypt is last available for Delphi
6.
Also i am not sure, if DCPCrypt will allow me to store encrypted string
to a
text file and retrieve it later.
Thanks for the immediate link though. I am still searching group
archives
for "that" discussion of last year.
Warm regards,
Jatin N. Bhoir
----- Original Message -----
From: "Daniel Rail" <[email protected]>
To: <[email protected]>
Sent: Monday, August 18, 2003 5:13 PM
Subject: Re: [Delphi] String encryption
> Hi,
>
> At August 18, 2003, 08:00, Jatin N. Bhoir wrote:
>
> > Hi,
>
> > Any suggestions on string encryption routines like BlowFish, etc.
> > I need to encrypt a string and store it to a text file and retrieve
> > it later (of coz). Most routines that i checked are not available
> > after Delphi 5.
>
> > I remember last year discussing about this issue. I checked group
> > archives, but i seem to be lost in finding the appropriate
> > discussion thread.
>
> > I believe the trouble lies when an encrypted key is persistently
> > stored in string format. Am i clubbing too many ideas here ?
>
> > Can anyone suggest please ? I need to store data in INI files
> > "key=value" pair, but in encrypted format.
>
> Try DCPCrypt 2, http://www.cityinthesky.co.uk/cryptography.html
>
> It works for me.
Delphi VCL Top Sites!
http://www.sandbrooksoftware.com/TS/TS2/Components.shtml
---------------------------------------------------------------
Unsubscribe:[email protected]
List owner:[email protected]
---------------------------------------------------------------
Your use of Yahoo! Groups is subject to
http://docs.yahoo.com/info/terms/
------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Ink Cartridges or Refill Kits for Your HP, Epson, Canon or Lexmark
Printer at Myinks.com. Free s/h on orders $50 or more to the US & Canada. http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/l.m7sD/LIdGAA/qnsNAA/i7folB/TM
---------------------------------------------------------------------~->
Delphi VCL Top Sites!
http://www.sandbrooksoftware.com/TS/TS2/Components.shtml
---------------------------------------------------------------
Unsubscribe:[email protected]
List owner:[email protected]
---------------------------------------------------------------
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/