Some good encryption functions I made/use.

You'll need the following constants which can be changed, just make sure they are the same number of digits in length. 
define("ENC_KEY","s62bc597w1725r9fhxshdx1r6h1mh818"); //encryption key
define("ENC_IV","61507591742180776653547102246712"); //encryption iv

function encrypt($data=""){
  return bin2hex(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, md5(MP_ENC_KEY), $data, MCRYPT_MODE_CBC, md5(MP_ENC_IV)));

function decrypt($data=""){
  return rtrim(mcrypt_decrypt(MCRYPT_RIJNDAEL_256, md5(MP_ENC_KEY), pack("H*" , $data), MCRYPT_MODE_CBC, md5(MP_ENC_IV)), "\0");

Note: Do not change your encryption key after they it has been set initially or you will not be able to decrypt.  Also you can use the following link to generate your own random set of keys.

Here is the code that my key generation page uses
echo 'Enc IV: ';
for ($i=0;$i<32;$i++) { echo rand(0,9); }

echo '<BR>Enc Key: ';
for ($i=0;$i<32;$i++)
    $letornum = rand(0,1);
    if($letornum==0) {
        echo rand(0,9);
    } else {
        echo chr(rand(ord("a"), ord("z")));