Changeset 2152 for lang/php/Cache/trunk/Handler/PlugIn/Crypt.php
- Timestamp:
- 11/30/07 01:35:15 (6 years ago)
- Files:
-
- 1 modified
-
lang/php/Cache/trunk/Handler/PlugIn/Crypt.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
lang/php/Cache/trunk/Handler/PlugIn/Crypt.php
r2082 r2152 6 6 * @category Cache 7 7 * @description crypt cache data to make difficult for reading data 8 * @see http://labs.unoh.net/2007/11/php_de_crypt.html 暗号化はこれを参考 8 9 */ 9 10 10 require_once 'Cache/Handler/PlugIn/Interface.php';11 //require_once 'Cache/Handler/PlugIn/Interface.php'; 11 12 12 class Cache_Handler_PlugIn_Crypt implements Cache_Handler_PlugIn_Interface{13 class Cache_Handler_PlugIn_Crypt/* implements Cache_Handler_PlugIn_Interface */{ 13 14 /** 14 15 * @access public … … 17 18 { 18 19 $this->crypt_keyword = $key; 19 $this->crypt_function_name = "undefined";20 20 } 21 22 public function encode($data){ 23 return $data ; 21 private function initMcrypt(){ 22 /** 23 * 初期化ベクトルを用意する 24 * Windowsの場合、MCRYPT_DEV_URANDOMの代わりにMCRYPT_RANDを使用する 25 */ 26 $iv = mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_BLOWFISH, MCRYPT_MODE_CBC), MCRYPT_DEV_URANDOM); 27 // 事前処理 28 $resource = mcrypt_module_open(MCRYPT_BLOWFISH, '', MCRYPT_MODE_CBC, '');; 24 29 } 25 public function decode($data){ 26 return $data ; 30 private function encode($data){ 31 return $encrypted_data = mcrypt_cbc(MCRYPT_BLOWFISH, $this->crypt_keyword, $data, MCRYPT_ENCRYPT, $this->iv); 32 } 33 private function decode($data){ 34 return $encrypted_data = mcrypt_cbc(MCRYPT_BLOWFISH, $this->crypt_keyword, $data, MCRYPT_DECRYPT, $this->iv); 27 35 } 28 36 /** … … 48 56 49 57 } 58 59 /////////test 60 //$crypter = new Cache_Handler_PlugIn_Crypt("test"); 61 //$data = "Googleのエンジニアってすごいよね"; 62 //echo "------------"; 63 //echo "\n"; 64 //echo $data = $crypter->beforeWrite($data); 65 //echo "\n"; 66 //echo "------------"; 67 //echo "\n"; 68 //echo $data = $crypter->afterRead($data); 69 //echo "\n";
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)