Decrypting password in a database

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
Beginner
Posts: 6
Joined: Thu Aug 15, 2013 7:53 am

Decrypting password in a database

Post by Beginner » Thu Aug 15, 2013 7:20 pm

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

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: Decrypting password in a database

Post by Simon » Mon Aug 19, 2013 1:03 am

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
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

Post Reply