Solved

PHP simple encode/decode string

Posted on 2007-03-21
5
218 Views
Last Modified: 2012-06-27
Hi
I need something similar to md5 that will encode a string such as

"This is a test"
to
“ce114e4501d2f4e2dcea3e17b546f339”

I want to pass the encoded string as a URL parameter, at the landing page I would like to convert it back to a string. I don’t want my site visitors to know what is being passed. Md5 would suit perfectly if there was a way to convert it back to a string.  Security for the string is not an issue.

Any help would be appreciated.
0
Comment
Question by:sabecs
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 48

Expert Comment

by:hernst42
ID: 18765601
You could use uuencode and uudecode.
http://de3.php.net/manual/en/function.convert-uudecode.php
http://de3.php.net/manual/en/function.convert-uuencode.php

Or use sessions generate a random hash. store the has and the clear text calue in the session and when you get the hash back resolve it via session-lookup
0
 

Author Comment

by:sabecs
ID: 18766768
Thanks hernst42,
Sorry I should have mentioned that I need a solution using PHP 4, uudecode is only available in PHP 5 which I don't have. Also, I am not sure if sessions will work as the url is coming from another website.
0
 
LVL 9

Expert Comment

by:richdiesal
ID: 18768393
I believe the easiest way would be to use mcrypt, although you will need to download and install it.
See http://www.php.net/mcrypt for details.
0
 
LVL 48

Accepted Solution

by:
hernst42 earned 500 total points
ID: 18769613
The uudecode and uuencode functions are available in PHP4 if you install the pear-package PHP_Compat. A very simple method is to use
http://www.php.net/manual/en/function.base64-encode.php
http://www.php.net/manual/en/function.base64-decode.php
0
 

Author Comment

by:sabecs
ID: 18770678
Thanks hernst42 for your help.
0

Featured Post

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

691 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question