how to check Encrypt() and Decrypt()?

how to check Encrypt() and Decrypt()?

Postby dutch » Sun Feb 16, 2020 7: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 19.01 / 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)
User avatar
dutch
 
Posts: 1535
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Re: how to check Encrypt() and Decrypt()?

Postby Antonio Linares » Sun Feb 16, 2020 8:42 am

Dutch,

This is a first idea that you could enhance:
Code: Select all  Expand view
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
User avatar
Antonio Linares
Site Admin
 
Posts: 41315
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: how to check Encrypt() and Decrypt()?

Postby cnavarro » Sun Feb 16, 2020 10:11 am

Yo lo uso así:
Code: Select all  Expand view

      cCad  := hb_Crypt( cCad, cPassW )
 

Code: Select all  Expand view

     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
User avatar
cnavarro
 
Posts: 6500
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: how to check Encrypt() and Decrypt()?

Postby Antonio Linares » 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
User avatar
Antonio Linares
Site Admin
 
Posts: 41315
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: how to check Encrypt() and Decrypt()?

Postby dutch » 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 19.01 / 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)
User avatar
dutch
 
Posts: 1535
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Re: how to check Encrypt() and Decrypt()?

Postby Antonio Linares » 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
User avatar
Antonio Linares
Site Admin
 
Posts: 41315
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: how to check Encrypt() and Decrypt()?

Postby dutch » Tue Feb 18, 2020 2: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 19.01 / 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)
User avatar
dutch
 
Posts: 1535
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 76 guests