How to decrypt a crypto encrypted string

I want to encrypt a password that is saved on the device.

I'm trying:

1
2
require "crypto"
print (crypto.hmac( crypto.md5, "key", "test" ))   -->  171d80f9cebec0767287d2eb2e4b2abc

MD5 is a one-way cryptographic hash algorithm, you aren't supposed to be able to get the original chars back: http://en.wikipedia.org/wiki/One-way_function

Thanks singh206.

Of course the purpose of such a one-way function is beyond me so I won't worry about it :-)

Have decided not to encrypt anyways.
One less item to possibly trip over at the app store.

It's commonly used to store sensitive info in databases, like passwords. If an unauthorized person gains access to the database they won't acquire the actual passwords, only the encrypted hash you've stored. It's also used for verifying the integrity of file content. A hash of [myfile]sometext[/myfile] can prove that a hacker didn't tamper with it because the hash of the original and [myfile]sometaintedtext[/myfile] are different.

Depending on your need, you could explore writing your own obfuscation library. I'm pretty sure there are 2 way encryption libs, mcrypt or SHA1? But I've never used a 2 way myself.

views:1880 update:2011/10/2 9:44:12
corona forums © 2003-2011