you can use for the encoding desired purpose sha1 functions check this: http://php.net/manual/en/function.sha1.php or you can use this link too
You can use one of PHP's encryption functions (mcrypt) to encrypt your data, then use base64_encode to encode it into a string that can be sent as text.
Have a look at the Crypt_XXTEA Pear Package. You can encrypt/decrypt arbitrary Strings with it. It uses the XXTEA block cipher algorithm (see XXTEA at Wikipedia). If you want to have a "nice" format, you can additionally uuencode the encrpted output.
Use something simple like rot13 and append a extra set of characters to each number. Yes this is a really weak form of encryption but it solves the question and you can make the output match what ever you want.
If the user wants something more complex then try using tweber's answer , but then you cant really control the length or randomness of the string output.