PC SOFT

FOROS PROFESIONALES
WINDEVWEBDEV y WINDEV Mobile

Inicio → WINDEV 2024 → Crypt / Uncrypt
Crypt / Uncrypt
Iniciado por Diego Pianarosa, 11,feb. 2010 08:01 - 2 respuestas
Publicado el 11,febrero 2010 - 08:01
Hi to all,
I'm new to windev, so, be patient with me.

I build a project that use a Access 2007 DB. In one of project's windows I need to encrypt a password field and save to the db.

I have a edit text with name EDT_PASSWORD (with value for example = "password"), in the code i have

sCryptedPassword = Crypt(EDT_PASSWORD, "12345")

User.Password = sCryptedPassword

Ok, the value is saved in the db

When I try to Decrypt the password I find a strange problem, I use this code

sDecryptedPassword = Uncrypt(User.Password, "12345")

the value in the string is: "p<0>a<0>s<0>s<0>w<0>o<0>r<0>d<0>"

if i try to crypt and decrypt the same password without saving the value to the db there's no problem.

Why this????
Publicado el 11,febrero 2010 - 13:24
Hi Diego

it LOOKS like some of your data cycle is done in ANSI, and some in
unicode (ie 2 bytes per character), so when the value comes back, there
is this additional '0' (the second byte) for each character

So you should first identify what is ansi and what is unicode, and then
decide what to change

Best regards


--
Fabrice Harari
Consultant WinDev, WebDev et WinDev Mobile International

Plus d'information sur http://fabriceharari.com/index_FR.html


On 2/11/2010 2:01 AM, Diego Pianarosa wrote:
Hi to all,
I'm new to windev, so, be patient with me.

I build a project that use a Access 2007 DB. In one of project's windows I need to encrypt a password field and save to the db.

I have a edit text with name EDT_PASSWORD (with value for example = "password"), in the code i have

sCryptedPassword = Crypt(EDT_PASSWORD, "12345")

User.Password = sCryptedPassword

Ok, the value is saved in the db

When I try to Decrypt the password I find a strange problem, I use this code

sDecryptedPassword = Uncrypt(User.Password, "12345")

the value in the string is: "p<0>a<0>s<0>s<0>w<0>o<0>r<0>d<0>"

if i try to crypt and decrypt the same password without saving the value to the db there's no problem.

Why this????


Publicado el 13,febrero 2010 - 12:03
Hi Fabrice,

you're right, the problem was just this.

Thanks

Diego