Reputation: 535
I'm trying to decrypt a variable that I've encrypted from my web server and haven't gotten any luck. I've encrypted the variable on the site using sha1(variable) in php, but am stuck trying to decrypt it once its passed back to the iphone. If you have any other code other than sha1 that works, im happy with that too. thanks
Upvotes: 0
Views: 138
Reputation: 171
True, MD5 & SHA1 are one way hash algorithms. If you want to be able to encode and then decode a variable you will need to use the mcrypt functions.
Upvotes: 1
Reputation: 38606
If you have the password hashed, then you shouldn't need to 'un-hash' it, right? That's the whole point. You have the password stored in the db/server as a hash, and when you need to check it, you hash the user's login attempt and compare. Or perhaps I'm missing something?
Upvotes: 0
Reputation: 163268
You cannot decrypt a one-way hash. Key words here are one-way. The hashing algorithm only works one way.
In order to do a validity check, you should first compute the hash of the other string, then compare those.
Upvotes: 2
Reputation: 754090
SHA1 is not an encryption technique.
SHA1 is a hash. It is designed to be irreversible.
Upvotes: 3