В библиотеке mcrypt есть много функций, позволяющих выполнять шифрование любым возможным способом.Вот пример использования AES:
$secretKey = 'the longer, the better';
$originalString = 'some text here';
$iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_CBC);
$iv = mcrypt_create_iv($iv_size, MCRYPT_RAND);
$crypttext = mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $secretKey, $originalString,
MCRYPT_MODE_CBC, $iv);
printf( "Original string: %s\n", $originalString );
// Returns "Original string: some text here"
printf( "Encrypted string: %s\n", $crypttext );
// Returns "Encrypted string: <gibberish>"
$decrypttext = mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $secretKey, $crypttext,
MCRYPT_MODE_CBC, $iv);
// Drop nulls from end of string
$decrypttext = rtrim($decrypttext, "\0");
printf( "Decrypted string: %s\n", $decrypttext );
// Returns "Decrypted string: some text here"