Useful Links
You will need to login before you can post. Please enter the following details:
User Name:    Password: 
Looking for something?
Want to be more precise?
Advanced Search
 

Go Back  NetBusinessTalk.com > Developing an Internet Business > Website Coding & Technology > Encoding & Decoding


Reply
 
LinkBack Thread Tools Display Modes
Old 03-30-06, 09:16 PM   #1
Busy Member
 
Join Date: Mar 2006
Posts: 209
Default Encoding & Decoding


Is there an easy way to encode and then decode a string in PHP? It's probably base64, but I'd like to add a custom string to make it un-decodable without the string. I hope I haven't lost anyone.

Quote:
eg,
$code = 'encode me';
$str = base64_encode("blah".$code);
How would I decode that?

Mike C is offline   Reply With Quote
Old 03-30-06, 10:51 PM   #2
ed
Guest
 
Posts: n/a
Default Re: Encoding & Decoding

I don't know if there is an easier way to do this, but here is an idea:

base64 encode it, then use str_replace to replace certain characters (for example 1 with a9di). Then you just have to reverse that algorithm and base64_decode it.
  Reply With Quote
Old 03-31-06, 07:56 PM   #3
Busy Member
 
Join Date: Mar 2006
Posts: 209
Default Re: Encoding & Decoding

Thanks for the suggestion. I figured something along those lines would be my best bet.
Mike C is offline   Reply With Quote
Old 03-31-06, 09:37 PM   #4
Max
Advisor
 
Join Date: Nov 2005
Location: New York
Posts: 593
Default Re: Encoding & Decoding

You could do a base64 encode and then salt it with your own algorithm. It's the same concept as md5 and salting passwords.
__________________
Max - NBT Advisor
Max is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 06:30 PM.

© 2006 - 2008 Net Business Talk Forums | About Net Business Talk Forums | Legal | A member of the Crowdgather Forum Community
 
 
Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.1.0
Designed by Vbulletinskinz.com