14 if (!function_exists(
'mcrypt_encrypt')) {
15 trigger_error(
'Mcrypt functions are not available',
E_USER_ERROR);
43 $this->_cipher = $cipher;
67 $this->_source = $source;
74 $cipher = MCRYPT_RIJNDAEL_256;
77 $mode = MCRYPT_MODE_ECB;
80 $source = MCRYPT_RAND;
83 $this->_cipher = $cipher;
85 $this->_source = $source;
91 $iv_size = mcrypt_get_iv_size($this->_cipher, $this->_mode);
92 $iv = mcrypt_create_iv($iv_size, $this->_source);
93 return mcrypt_encrypt($this->_cipher, $key, $data, $this->_mode, $iv);
98 function read($data, $key) {
99 $iv_size = mcrypt_get_iv_size($this->_cipher, $this->_mode);
100 $iv = mcrypt_create_iv($iv_size, $this->_source);
101 $rv = mcrypt_decrypt($this->_cipher, $key, $data, $this->_mode, $iv);
102 return rtrim($rv,
"\0");
ADODB_Encrypt_MCrypt($cipher=null, $mode=null, $source=null)
if(!defined('ADODB_ERROR_HANDLER_TYPE')) define('ADODB_ERROR_HANDLER_TYPE' E_USER_ERROR