Thanks Przemek and Rodrigo.
Sérgio
--------------------------------------------------
From: "Przemyslaw Czerpak" <dru...@acn.waw.pl>
Sent: Tuesday, January 27, 2009 9:42 AM
To: "Harbour Project Main Developer List." <harbour@harbour-project.org>
Subject: Re: [Harbour] Compact .HRB or encrypt string in .HRB
On Mon, 26 Jan 2009, Sérgio Kondo wrote:
Hi,
Is possible to compact .hrb files or encrypt string in .hrb files?
My interest is hide password string in .hrb files, if I put password
string in this file.
You can make anything what you want with .hrb files body. You only
have to decode it before you will call HB_HRBLOAD( <cHrbBody> ), f.e.
you can use this function to compress and encrypt .hrb files:
proc encode_hrb( cKey )
local cHrbBody, file
for each file in directory( "*.hrb" )
cHrbBody := hb_memoread( file[ 1 ] )
if !empty( cHrbBody )
cHrbBody := hb_zcompress( cHrbBody )
cHrbBody := sx_encrypt( cHrbBody, cKey )
hb_memowrit( file[ 1 ] + "enc", cHrbBody )
endif
next
return
and this one to load such files:
proc load_hrb( cKey, cFile, /* init function parameters*/ ... )
local cHrbBody
cHrbBody := hb_memoread( cFile )
cHrbBody := sx_decrypt( cHrbBody, cKey )
cHrbBody := hb_zuncompress( cHrbBody )
hb_hrbLoad( cHrbBody, ... )
return
In both functions <cKey> is used as encryption key. It's not strong
encryption but for simple string hiding should be enough.
best regards,
Przemek
_______________________________________________
Harbour mailing list
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour
_______________________________________________
Harbour mailing list
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour