Page 1 of 1
how to check Encrypt() and Decrypt()?
Posted: Sun Feb 16, 2020 7:26 am
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.
Re: how to check Encrypt() and Decrypt()?
Posted: Sun Feb 16, 2020 8:42 am
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" ) )
Re: how to check Encrypt() and Decrypt()?
Posted: Sun Feb 16, 2020 10:11 am
by cnavarro
Yo lo uso así:
Code: Select all
cCad := hb_Decrypt( cCad, cPassW )
Re: how to check Encrypt() and Decrypt()?
Posted: Sun Feb 16, 2020 11:43 am
by Antonio Linares
ok, this way works fine:
? hb_decrypt( hb_crypt( "hello", "key" ), "key" )
thanks Cristobal!
Re: how to check Encrypt() and Decrypt()?
Posted: Sun Feb 16, 2020 11:55 pm
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
Re: how to check Encrypt() and Decrypt()?
Posted: Mon Feb 17, 2020 12:18 pm
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
Re: how to check Encrypt() and Decrypt()?
Posted: Tue Feb 18, 2020 2:33 am
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