how to check Encrypt() and Decrypt()?

Post Reply
User avatar
dutch
Posts: 1395
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

how to check Encrypt() and Decrypt()?

Post by dutch »

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
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

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

Post by Antonio Linares »

Dutch,

This is a first idea that you could enhance:

Code: Select all

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

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

Post by cnavarro »

Yo lo uso así:

Code: Select all

      cCad  := hb_Crypt( cCad, cPassW )
 

Code: Select all

     cCad := hb_Decrypt( cCad, cPassW )
 
C. Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
Si alguien te dice que algo no se puede hacer, recuerda que esta hablando de sus limitaciones, no de las tuyas.
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

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

Post by Antonio Linares »

ok, this way works fine:

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

thanks Cristobal!
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
dutch
Posts: 1395
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

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

Post by dutch »

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
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

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

Post by Antonio Linares »

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
dutch
Posts: 1395
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

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

Post by dutch »

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)
Post Reply