Showing posts with label encoding in PHP. Show all posts
Showing posts with label encoding in PHP. Show all posts

Wednesday, January 7, 2009

UUEncoding and UUDecoding

convert_uuencode() function


This function encodes a string using the Unix-to-Unix encoding algorith.


syntax: convert_uuencode(string);

string – the input string

convert_uudecode() function

This function decodes a UU Encoded string.


snytax: convert_uudecode(string);

string – the encoded string

Example input:

$str = "This is Vince";
echo $str;
echo "";
echo convert_uuencode($str);
echo "";
echo convert_uudecode($encstr);

Example output:
This is Vince -5&AI

r!6:6yc90``>

Thursday, October 16, 2008

The str_rot13() function

This function performs ROT13 encoding on a string.

Syntax: str_rot13(string);

Example input:

$str1="This is a simple program number 1";
$str2= str_rot13($str1);
echo $str2;
echo "
";
echo $str3= str_rot13($str2);

Example output:

Guvf vf n fvzcyr cebtenz ahzore 1
This is a simple program number 1

What is ROT13?

A ROT13 enoding algorithm moves every character in a string 13 places forward. Numbers and special characters, however, are untouched.


Another interesting fact about the ROT13 algorithm is that the same algorithm could be used for encoding as well as decoding as you’d understand when you analyze the example.

myLot User Profile