New file format

New file format

Postby Silvio.Falconi » Sun Nov 20, 2022 11:33 am

I saved a table in an ascii file with the separator character "," or ";" but I would like to protect this file and create a particular and personalized format that no one could reopen but me with my little program
of course I need the save function and to load the file and once saved
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7052
Joined: Thu Oct 18, 2012 7:17 pm

Re: New file format

Postby Otto » Sun Nov 20, 2022 4:45 pm

Silvio,
maybe this helps.

Best regards,

Otto

Code: Select all  Expand view

// New FiveWin Encrypt() and Decrypt() functions

#include "FiveWin.ch"

//----------------------------------------------------------------------------//

function Main()

   local cTest1 := "FiveWin - The CA-Clipper for Windows Library"
   local cTest2 := "FiveWin - The CA-Clipper for Windows Library"

   MsgInfo( cTest1 := Encrypt( cTest1, "User1Key" ) )
   MsgInfo( cTest2 := Encrypt( cTest2, "Another" ) )

   MsgInfo( cTest1 := Decrypt( cTest1, "User1Key" ) )
   MsgInfo( cTest2 := Decrypt( cTest2, "Another" ) )

return nil

//----------------------------------------------------------------------------//


 
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6329
Joined: Fri Oct 07, 2005 7:07 pm

Re: New file format

Postby Silvio.Falconi » Sun Nov 20, 2022 8:00 pm

Perhaps can be a good idea!!
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7052
Joined: Thu Oct 18, 2012 7:17 pm

Re: New file format

Postby Silvio.Falconi » Tue Nov 22, 2022 9:00 am

Otto wrote:Silvio,
maybe this helps.

Best regards,

Otto

Code: Select all  Expand view

// New FiveWin Encrypt() and Decrypt() functions

#include "FiveWin.ch"

//----------------------------------------------------------------------------//

function Main()

   local cTest1 := "FiveWin - The CA-Clipper for Windows Library"
   local cTest2 := "FiveWin - The CA-Clipper for Windows Library"

   MsgInfo( cTest1 := Encrypt( cTest1, "User1Key" ) )
   MsgInfo( cTest2 := Encrypt( cTest2, "Another" ) )

   MsgInfo( cTest1 := Decrypt( cTest1, "User1Key" ) )
   MsgInfo( cTest2 := Decrypt( cTest2, "Another" ) )

return nil

//----------------------------------------------------------------------------//


 


Sorry I not understood how make it because I create csv from xbrowse with oBrw:ToCSV( cFile, , .f., , , "," ) and cFile is the name of the file
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7052
Joined: Thu Oct 18, 2012 7:17 pm

Re: New file format

Postby nageswaragunupudi » Tue Nov 22, 2022 3:08 pm

Do not provide the file name as the first paramter. Keep it NIL.
Then the method returns CsvText.
Code: Select all  Expand view

cCsvText := oBrw:ToCSV( NIL, , .f., , , "," )
cCsvText := ENCRYPT( cCsvText, cKey )
HB_MEMOWRIT( cFile, cCsvText )
 


No need to modify the classes of xbrowse.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10625
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: New file format

Postby nageswaragunupudi » Tue Nov 22, 2022 3:08 pm

Do not provide the file name as the first paramter. Keep it NIL.
Then the method returns CsvText.
Code: Select all  Expand view

cCsvText := oBrw:ToCSV( NIL, , .f., , , "," )
cCsvText := ENCRYPT( cCsvText, cKey )
HB_MEMOWRIT( cFile, cCsvText )
 


No need to modify the classes of xbrowse.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10625
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: New file format

Postby Silvio.Falconi » Tue Nov 22, 2022 5:41 pm

nageswaragunupudi wrote:Do not provide the file name as the first paramter. Keep it NIL.
Then the method returns CsvText.
Code: Select all  Expand view

cCsvText := oBrw:ToCSV( NIL, , .f., , , "," )
cCsvText := ENCRYPT( cCsvText, cKey )
HB_MEMOWRIT( cFile, cCsvText )
 


No need to modify the classes of xbrowse.


thanks...why I 'm seeing two answers?
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7052
Joined: Thu Oct 18, 2012 7:17 pm

Re: New file format

Postby Antonio Linares » Tue Nov 22, 2022 9:14 pm

Dear Silvio,

You should use Harbour's HB_BLOWFISHENCRYPT() if you want the max security

FWH Encrypt() and Decrypt() are quite simple, enough for many people, but an expert could break it
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42081
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: New file format

Postby Silvio.Falconi » Tue Nov 22, 2022 10:18 pm

I Wish create a new file format but i not knor how make It
to start I can settle for the encript /decriot functions, but I wanted to save all the information I need in a single file: in reality they are matrices for creating betting systems for the lotto scheme title, rows, columns, guarantee, points and then the whole scheme that could have up to a maximum of ten columns but infinite rows depending on the numbers that are played if they are placed in doubles or triplets or quadruplets, five, _, sevenths, eights, novines and tens.
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7052
Joined: Thu Oct 18, 2012 7:17 pm

Re: New file format

Postby Antonio Linares » Tue Nov 22, 2022 10:30 pm

Dear Silvio,

Save the info into a Harbour hash, then generate a JSON file from it, then encrypt it to disk

Then you can read it back, decrypt it and recover the JSON and then convert it into a Harbour hash again

Thats what I would do :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42081
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: New file format

Postby Silvio.Falconi » Wed Nov 23, 2022 9:27 am

for Now
File ascii cripted
name of file
NXX_GXEX_LXX.TBL

sample : N08_G2E2_L03.TBL -> 8 numbers, Guarantee 2, Points 2 , scheme in triplets

the problem is when I select the numbers sample :

Image

the procedure should search for a 9-digit scheme and list the schemes found
on a xbrowse two colomuns if the procedure found that schemes it must write
"should convert the abbreviation N08_G2E2_L03 to
scheme | columns
"guarantee 2 numbers with 8 numbers" | 3
and it's not easy
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7052
Joined: Thu Oct 18, 2012 7:17 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Willi Quintana and 93 guests