Page 1 of 1

Decrypting password in a database

Posted: Thu Aug 15, 2013 7:20 pm
by Beginner
Hi, I have a database file containing a table UaP with the fields of Username and Password
The password is salted and encrypted and then stored in the database.
However, when I try to take out the value and decrypt it, it doesnt return anything even though I could get the password

put revOpenDatabase("sqlite",path, , , , ) into connID
put revDataFromQuery(tab,return,connID,"SELECT Username FROM UaP where Username like 'User'") into gname
put revDataFromQuery(tab,return,connID,"SELECT Password FROM UaP") into gpw

answer gpw (return "Salted__rtyudfgh†N'AÖÅaKž4XJÌŸ" which is the correct value of the encrypted password)

put "poilkjqweasd123!@#" into tPassword
put "rtyudfgh" into tSalt

decrypt gpw using "aes256" with password tPassword and salt tSalt
put it into gpw
answer gpw (returns nothing)

Is there a solution to this where I can get the password in a text form and decrypt it successfully?
I tried hardcoding the decryption process by doing
[ decrypt "Salted__rtyudfgh†N'AÖÅaKž4XJÌŸ" using "aes256" with password tPassword and salt tSalt ]
and it works fine

Re: Decrypting password in a database

Posted: Mon Aug 19, 2013 1:03 am
by Simon
Try something like this:
answer the number of char of gpw
and check that it's 33
or
charToNumber(the last char of gpw)

Saw this in another posting where there was a "return" at the end of the string. You wouldn't see it in an "answer" or gpw.

Simon