FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour how to check Encrypt() and Decrypt()?
Posts: 1598
Joined: Fri Oct 07, 2005 05:56 PM
how to check Encrypt() and Decrypt()?
Posted: Sun Feb 16, 2020 07:26 AM

If I Encrypt() data in a field. How to I ensure that, this field contain Encrypt data?

As Six Driver SX_TABLETYPE(), it will return 1 as Normal, 2 as Encrypt DBF.

How to check it, because when I use Encrypt() again. It did as twice encrypt.

Thanks in advance.

Regards,

Dutch



FWH 2304 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio

FWPPC 10.02 / Harbour for PPC (FTDN)

ADS V.9 / MySql / MariaDB

R&R 12 Infinity / Crystal Report XI R2

(Thailand)
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: how to check Encrypt() and Decrypt()?
Posted: Sun Feb 16, 2020 08:42 AM
Dutch,

This is a first idea that you could enhance:
Code (fw): Select all Collapse
function Main()

   ? IsEncrypted( hb_crypt( "Hello" ) )

return nil

function IsEncrypted( cText )

   local c
   
   for each c in cText
      if ! Lower( c ) $ "abcdefghijklmnopqrstuvwxyz0123456789()[]{}"
         return .T.
      endif
   next
   
return .F.


Anyhow I have found with great surprise that this is not wotking fine:
? hb_decrypt( hb_crypt( "hello" ) )
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: how to check Encrypt() and Decrypt()?
Posted: Sun Feb 16, 2020 10:11 AM
Yo lo uso así:
Code (fw): Select all Collapse
      cCad  := hb_Crypt( cCad, cPassW )

Code (fw): Select all Collapse
     cCad := hb_Decrypt( cCad, cPassW )
Cristobal Navarro

Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo

El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: how to check Encrypt() and Decrypt()?
Posted: Sun Feb 16, 2020 11:43 AM

ok, this way works fine:

? hb_decrypt( hb_crypt( "hello", "key" ), "key" )

thanks Cristobal!

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1598
Joined: Fri Oct 07, 2005 05:56 PM
Re: how to check Encrypt() and Decrypt()?
Posted: Sun Feb 16, 2020 11:55 PM

Dear Antonio&Cnavarro,

Thank you both of you. I got it, we have to write our own function. I've another question.

Which is the best Hb_crypt() and Encrypt() or etc.? Because of GDPR.

Thank you in advance

Regards,

Dutch



FWH 2304 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio

FWPPC 10.02 / Harbour for PPC (FTDN)

ADS V.9 / MySql / MariaDB

R&R 12 Infinity / Crystal Report XI R2

(Thailand)
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: how to check Encrypt() and Decrypt()?
Posted: Mon Feb 17, 2020 12:18 PM

Dutch,

Having hb_crypt() and hb_decrypt() and I would advise to use them instead of FWH Encrypt() and Decrypt()

Please be aware that they are not compatible. So please decrypt before changing encryption functions

On the other hand, Harbour functions source code is available, meanwhile FWH encription functions source code it is not

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1598
Joined: Fri Oct 07, 2005 05:56 PM
Re: how to check Encrypt() and Decrypt()?
Posted: Tue Feb 18, 2020 02:33 AM
Dear Antonio,

Thanks a lot, I got it.
Antonio Linares wrote:Dutch,

Having hb_crypt() and hb_decrypt() and I would advise to use them instead of FWH Encrypt() and Decrypt()

Please be aware that they are not compatible. So please decrypt before changing encryption functions

On the other hand, Harbour functions source code is available, meanwhile FWH encription functions source code it is not
Regards,

Dutch



FWH 2304 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio

FWPPC 10.02 / Harbour for PPC (FTDN)

ADS V.9 / MySql / MariaDB

R&R 12 Infinity / Crystal Report XI R2

(Thailand)

Continue the discussion