some ASCII to String Encryption

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
zm50
Forum Newbie
Posts: 2
Joined: Wed Feb 08, 2006 7:32 pm

some ASCII to String Encryption

Post by zm50 »

I have been given a file that is simply encrypted that I need to decode. I have permission to decode this file. I am trying to do this decoding on a server with PHP. Basically the decode algorithim would function something like this: each 3 digit ascii code in the file takes the last of the 3 digit ascii codes, add that value to the code, and then converts the result to an a character. Has anyone seen this done, have code to do this already, or know of any good resources?

Thanks
User avatar
raghavan20
DevNet Resident
Posts: 1451
Joined: Sat Jun 11, 2005 6:57 am
Location: London, UK
Contact:

Post by raghavan20 »

if you know the logic properly,,,then you can come up with pseudo code and we will help you to convert it into PHP code...
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Post by josh »

Looks like you will need chr() and ord()
zm50
Forum Newbie
Posts: 2
Joined: Wed Feb 08, 2006 7:32 pm

Post by zm50 »

Hey guys - thanks for your comments; i used the chr() and ord() functions. I am still working on the manipulation the actual values - but have a script now i wrote that can do what i need. thanks again for the help!
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Post by josh »

By the way, the encryption sounds pretty weak, a good method involves something that requires a private key to decrypt the string, such as xor'ing each character with a value from the private key
Post Reply