Using uuencode for passwords isn't any more secure than plain text (maybe slightly: non-developers or too lazy to figure out what you used). mcrypt or even md5 is much more secure.
convert_uuencode — Uuencode a string
convert_uuencode() encodes a string using the uuencode algorithm.
Uuencode translates all strings (including binary's ones) into printable characters, making them safe for network transmissions. Uuencoded data is about 35% larger than the original.
The data to be encoded.
Returns the uuencoded data.
Example #1 convert_uuencode() example
$some_string = "test\ntext text\r\n";
if you want to use convert_uuencode with command uudecode you must insert a line "begin %s %s\n" at the beginning and "end\n" at the end:
echo "begin 644 hello.txt\n";
the first arg. after begin is the mode (destination file rights), the second is the destination file name.
Then you can do a wget followed by a uudecode.
note that using base64 or uuencode to store data in a database is pretty useless. if you properly escape your data and use a binary field (BLOB etc) there is no problem.
@Craig's note: base64_encode() is better suited for that. In fact, it produces smaller output and operates slightly faster. I did a little benchmark -- here are my findings:
File: JPG, 631614 bytes
== Base64 ==
execution time: 0.0039639472961426 secs
output length: 842152
== UUencode ==
execution time: 0.004105806350708 secs
output length: 870226
Note to the tip of Craig at frostycoolslug dot com:
If you are using fulltext functionality on columns with uuencoded texts, collations will not work. You might prefer to pass the text escaped to the database engine.
uuencode is recognisable as email attachment in Ms Outlook, but in Outlook Express (at least in older versions) - is not.
This is shell script, but it may give you an idea how you can send attachments using uuencode:
cat file.bin | uuencode file.bin | mail firstname.lastname@example.org -s "file.bin"
uuencode mail attachments from other point of wiev are deprecated. However I use such technic for years now and it work well.
This functionality is now implemented in the PEAR package PHP_Compat.
More information about using this function without upgrading your version of PHP can be found on the below link:
This function can be useful if you wish to store files in a MySQL database, it will save any problems with obscure binary data breaking the queries.
just remember to convery-uudecode before you try to use the data again.
(A common example of something that uses this system, would be email attachments)