DiigIT | IT Community
No Profile Image
Welcome Guest
New User? Register | Login

crypting & de-crypting strings

By: | 18 Feb 2009 4:25 pm

Hello,

I am looking for a php function or script to encode a string and decode it (when required). Your help would be greatly appreciated.

have thought of "md5" but the resulting string cant be decoded again! crc32 and sha1 functions are not good either.

The function crypt () is also a One-way string encryption .. so that would not work as well. What I need it for is simply to encode (encrypt) a user`s email - which now appears on the web page as is - and when someone clicks a link to contact that
user, the script would decode it back to the proper email string. Hence the sender would not actually know the email address.

There are ways to do it via mysql database but I thought if a I could do the crypting (and then decoding) via pure php script, it would ne less of a lod on the mysql db. Any suggestions would be greatly appreciated. It is a bit urgent.

Best regards
 

Comments

I am looking for a php function or script to encode a



You are probably looking for something like

http://php.net/mcrypt_encrypt

http://php.net/mcrypt_decrypt

By: | 18 Feb 2009

You can simply use base64_encode() function to encode email and base64_decode() function to decrypt the email address.

best regards

By: | 18 Feb 2009

Leave a comment

Enter the text in the image
img
Can't read?
Type the characters you see in the picture below.


Close Move