3 if(function_exists('mcrypt_encrypt') && defined('MCRYPT_MODE_CFB')) {
5 public $cipher, $key, $iv, $key_size, $block_size;
8 function __construct($cipher) {
9 $this->cipher = $cipher;
10 $this->key_size = mcrypt_module_get_algo_key_size($cipher);
11 $this->block_size = mcrypt_module_get_algo_block_size($cipher);
12 $this->iv = str_repeat("\0", mcrypt_get_iv_size($cipher, 'ncfb'));
15 function setKey($key) {
23 function encrypt($data) {
24 return mcrypt_encrypt($this->cipher, $this->key, $data, 'ncfb', $this->iv);
27 function decrypt($data) {
28 return mcrypt_decrypt($this->cipher, $this->key, $data, 'ncfb', $this->iv);