?
Solved

PHP simple encode/decode string

Posted on 2007-03-21
5
Medium Priority
?
221 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 2000 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
The viewer will learn how to dynamically set the form action using jQuery.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses

741 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