Encode & Decode functions
Moderator: Rathinagiri
- salamandra
- Posts: 311
- Joined: Thu Jul 31, 2008 8:33 pm
- DBs Used: DBF, MySQL, SQL
- Location: Brazil
Encode & Decode functions
Hi to all,
Anybody knows if Encode & Decode functions are compatible with (or were ported to) UNICODE ?
Best regards,
[]´s Salamandra
Anybody knows if Encode & Decode functions are compatible with (or were ported to) UNICODE ?
Best regards,
[]´s Salamandra
There is one time in which is crucial awakening. That time is now. ( Buddha )
- salamandra
- Posts: 311
- Joined: Thu Jul 31, 2008 8:33 pm
- DBs Used: DBF, MySQL, SQL
- Location: Brazil
Re: Encode & Decode functions
Hi to all,
Well, Clipper and Harbour functions like Crypt(), HB_Crypt(), HB_Decrypt(), ENCODE <file> and DECODE <file> does not work properly with UNICODE.
I need to protect a single (and small, just 01 record) DBF file with sensitive data in a network environment.
I just need to open this file, pick up the content of a few data fields and close it imediately.
Any ideia about how to do ?
Tia,
[]´s Salamandra.
Well, Clipper and Harbour functions like Crypt(), HB_Crypt(), HB_Decrypt(), ENCODE <file> and DECODE <file> does not work properly with UNICODE.
I need to protect a single (and small, just 01 record) DBF file with sensitive data in a network environment.
I just need to open this file, pick up the content of a few data fields and close it imediately.
Any ideia about how to do ?
Tia,
[]´s Salamandra.
There is one time in which is crucial awakening. That time is now. ( Buddha )
- AUGE_OHR
- Posts: 2061
- Joined: Sun Aug 25, 2019 3:12 pm
- DBs Used: DBF, PostgreSQL, MySQL, SQLite
- Location: Hamburg, Germany
Re: Encode & Decode functions
hi,
will you use that DBF with different Environment ?
it it for password ?
for Password i do not Crypt it , i store HASH Value.
as i know ANSI and UNICODE work > CHR(128) so if limited i guess it will work in different Environment
will you use that DBF with different Environment ?
it it for password ?
for Password i do not Crypt it , i store HASH Value.
as i know ANSI and UNICODE work > CHR(128) so if limited i guess it will work in different Environment
have fun
Jimmy
Jimmy
- mustafa
- Posts: 1158
- Joined: Fri Mar 20, 2009 11:38 am
- DBs Used: DBF
- Location: Alicante - Spain
- Contact:
Re: Encode & Decode functions
Hola amigo Salamandra
Haber si te puede servir ? este Sample
Está implementado con la librería "Encripta.prg"
http://www.hmgforum.com/viewtopic.php?f ... afa#p45649
http://www.hmgforum.com/viewtopic.php?f ... ted#p32683
SQLITE
http://www.hmgforum.com/viewtopic.php?f ... ted#p59878
Saludos
Mustafa
Haber si te puede servir ? este Sample
Está implementado con la librería "Encripta.prg"
http://www.hmgforum.com/viewtopic.php?f ... afa#p45649
http://www.hmgforum.com/viewtopic.php?f ... ted#p32683
SQLITE
http://www.hmgforum.com/viewtopic.php?f ... ted#p59878
Saludos
Mustafa
- salamandra
- Posts: 311
- Joined: Thu Jul 31, 2008 8:33 pm
- DBs Used: DBF, MySQL, SQL
- Location: Brazil
Re: Encode & Decode functions
Hi @AUGE_OHR,
I have some problems with illegal copies of an ERP system (developed by me).
I want avoid piracy using a DBF file with some crypted fields (Ex. licensed user, serial number, etc.).
I have tried unsuccesfully al known functions of cryptography, that works fine in ANSI mode but does not work at all in UNICODE mode.
I don´t want to use a DBF file with crypted header, but a DBF file with crypted fields.
By the way, how do you get the password hash? have any working example of how i could to do this? I am highly interested...
Best Regards,
[]´s Salamandra - Brazil
No, it is not for use with passwords storage.
I have some problems with illegal copies of an ERP system (developed by me).
I want avoid piracy using a DBF file with some crypted fields (Ex. licensed user, serial number, etc.).
I have tried unsuccesfully al known functions of cryptography, that works fine in ANSI mode but does not work at all in UNICODE mode.
I don´t want to use a DBF file with crypted header, but a DBF file with crypted fields.
By the way, how do you get the password hash? have any working example of how i could to do this? I am highly interested...
Best Regards,
[]´s Salamandra - Brazil
There is one time in which is crucial awakening. That time is now. ( Buddha )
- salamandra
- Posts: 311
- Joined: Thu Jul 31, 2008 8:33 pm
- DBs Used: DBF, MySQL, SQL
- Location: Brazil
Re: Encode & Decode functions
Hola @mustafa,
Voy a probar con esta sugerencia y despues te comento si funcionó.
[]´Salamandra - Brasil
Muchas gracias por tu ajuda.mustafa wrote: ↑Mon Jun 01, 2020 12:33 pm Hola amigo Salamandra
Haber si te puede servir ? este Sample
Está implementado con la librería "Encripta.prg"
http://www.hmgforum.com/viewtopic.php?f ... afa#p45649
http://www.hmgforum.com/viewtopic.php?f ... ted#p32683
SQLITE
http://www.hmgforum.com/viewtopic.php?f ... ted#p59878
Saludos
Mustafa
Voy a probar con esta sugerencia y despues te comento si funcionó.
[]´Salamandra - Brasil
There is one time in which is crucial awakening. That time is now. ( Buddha )
- AUGE_OHR
- Posts: 2061
- Joined: Sun Aug 25, 2019 3:12 pm
- DBs Used: DBF, PostgreSQL, MySQL, SQLite
- Location: Hamburg, Germany
Re: Encode & Decode functions
hi,salamandra wrote: ↑Mon Jun 01, 2020 8:40 pm By the way, how do you get the password hash? have any working example of how i could to do this? I am highly interested...
sorry, Char2Hash() is a Xbase++ Function using SHA 1 Algorithms
i found these HASH Function in \Harbour\include\hbcompat.ch
Code: Select all
/* Hash item functions */
#xtranslate hb_Hash( [<x,...>] ) => Hash( <x> )
#xtranslate hb_HHasKey( [<x,...>] ) => HHasKey( <x> )
#xtranslate hb_HPos( [<x,...>] ) => HGetPos( <x> )
#xtranslate hb_HGet( [<x,...>] ) => HGet( <x> )
#xtranslate hb_HSet( [<x,...>] ) => HSet( <x> )
#xtranslate hb_HDel( [<x,...>] ) => HDel( <x> )
#xtranslate hb_HKeyAt( [<x,...>] ) => HGetKeyAt( <x> )
#xtranslate hb_HValueAt( [<x,...>] ) => HGetValueAt( <x> )
#xtranslate hb_HValueAt( [<x,...>] ) => HSetValueAt( <x> )
#xtranslate hb_HPairAt( [<x,...>] ) => HGetPairAt( <x> )
#xtranslate hb_HDelAt( [<x,...>] ) => HDelAt( <x> )
#xtranslate hb_HKeys( [<x,...>] ) => HGetKeys( <x> )
#xtranslate hb_HValues( [<x,...>] ) => HGetValues( <x> )
#xtranslate hb_HFill( [<x,...>] ) => HFill( <x> )
#xtranslate hb_HClone( [<x,...>] ) => HClone( <x> )
#xtranslate hb_HCopy( [<x,...>] ) => HCopy( <x> )
#xtranslate hb_HMerge( [<x,...>] ) => HMerge( <x> )
#xtranslate hb_HEval( [<x,...>] ) => HEval( <x> )
#xtranslate hb_HScan( [<x,...>] ) => HScan( <x> )
#xtranslate hb_HCaseMatch( [<x,...>] ) => HGetCaseMatch( <x> )
#xtranslate hb_HAutoAdd( [<x,...>] ) => HGetAutoAdd( <x> )
#xtranslate hb_HAllocate( [<x,...>] ) => HAllocate( <x> )
#xtranslate hb_HDefault( [<x,...>] ) => HDefault( <x> )
#if defined( HB_LEGACY_LEVEL5 )
#xtranslate hb_HSetCaseMatch( [<x,...>] ) => HSetCaseMatch( <x> )
#xtranslate hb_HSetAutoAdd( [<x,...>] ) => HSetAutoAdd( <x> )
#endif
---
License Problem : we all know the Problem ...
as i found out under harbour you can make Variable "invisibible" in EXE using
http://www.hmgforum.com/viewtopic.php?f=5&t=6448
Code: Select all
#pragma TEXTHIDDEN(1)
PUBLIC cPassword := "Q65h3l8j41B"
#pragma TEXTHIDDEN(0)
have fun
Jimmy
Jimmy
- salamandra
- Posts: 311
- Joined: Thu Jul 31, 2008 8:33 pm
- DBs Used: DBF, MySQL, SQL
- Location: Brazil
Re: Encode & Decode functions
Hi @AUGE_OHR,
I am trying to build a fully new Crypt() function thats be able to work fine with UNICODE (and ANSI of course) to encrypt just certain database fields and not the whole DBF table.
I´ll keep working on it and searching...
Best regards,
Salamandra - Brazil
No problem, don´t worry, it is not so important.sorry, Char2Hash() is a Xbase++ Function using SHA 1 Algorithms
HB_Hash() returns a hash table. I have not tested yet. (but I will)i found these HASH Function in \Harbour\include\hbcompat.ch
Code: Select all
/* Hash item functions */
#xtranslate hb_Hash( [<x,...>] ) => Hash( <x> )
#xtranslate hb_HHasKey( [<x,...>] ) => HHasKey( <x> )
#xtranslate hb_HPos( [<x,...>] ) => HGetPos( <x> )
#xtranslate hb_HGet( [<x,...>] ) => HGet( <x> )
#xtranslate hb_HSet( [<x,...>] ) => HSet( <x> )
#xtranslate hb_HDel( [<x,...>] ) => HDel( <x> )
#xtranslate hb_HKeyAt( [<x,...>] ) => HGetKeyAt( <x> )
#xtranslate hb_HValueAt( [<x,...>] ) => HGetValueAt( <x> )
#xtranslate hb_HValueAt( [<x,...>] ) => HSetValueAt( <x> )
.....
#xtranslate hb_HSetCaseMatch( [<x,...>] ) => HSetCaseMatch( <x> )
#xtranslate hb_HSetAutoAdd( [<x,...>] ) => HSetAutoAdd( <x> )
#endif
no Idea how they work
Yes, I use this but I need to hide more than a user name or a user password.Code: Select all
#pragma TEXTHIDDEN(1)
PUBLIC cPassword := "Q65h3l8j41B"
#pragma TEXTHIDDEN(0)
I am trying to build a fully new Crypt() function thats be able to work fine with UNICODE (and ANSI of course) to encrypt just certain database fields and not the whole DBF table.
I´ll keep working on it and searching...
Best regards,
Salamandra - Brazil
There is one time in which is crucial awakening. That time is now. ( Buddha )
- AUGE_OHR
- Posts: 2061
- Joined: Sun Aug 25, 2019 3:12 pm
- DBs Used: DBF, PostgreSQL, MySQL, SQLite
- Location: Hamburg, Germany
Re: Encode & Decode functions
hi,
i think you can test if working under UNICODE Environment
than you need some UNICODE Function to convert to ANSI before crypt/decrypt
when read at "HARBOUR string functions that support ANSI and UNICODE character set"
that Hb_MemoRead() work with both ...hm
i guess we talk about String so it might work with
instead of Hb_MemoRead() sou can try HB_UTF8TOSTR() which need same Codepage on Crypt / deCrypt
i think you can test if working under UNICODE Environment
than you need some UNICODE Function to convert to ANSI before crypt/decrypt
when read at "HARBOUR string functions that support ANSI and UNICODE character set"
that Hb_MemoRead() work with both ...hm
i guess we talk about String so it might work with
Code: Select all
IF lUniCode
cText := deCrpyt( Hb_MemoRead(Field->MyText) )
ELSE
cText := deCrpyt( Field->MyText)
ENDIF
have fun
Jimmy
Jimmy