當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Crypt_Rijndael::setIV方法代碼示例

本文整理匯總了PHP中Crypt_Rijndael::setIV方法的典型用法代碼示例。如果您正苦於以下問題:PHP Crypt_Rijndael::setIV方法的具體用法?PHP Crypt_Rijndael::setIV怎麽用?PHP Crypt_Rijndael::setIV使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Crypt_Rijndael的用法示例。


在下文中一共展示了Crypt_Rijndael::setIV方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: generateKey

 /**
  * @param null|string $input
  * @return string
  */
 public function generateKey($input = NULL)
 {
     $text = $input === NULL ? $this->username . ';' . date('d/m/Y H:i:s') . ';' . $this->ip : $input;
     $cipher = new \Crypt_Rijndael();
     $cipher->setKeyLength(256);
     $cipher->setBlockLength(128);
     $cipher->setKey(base64_decode($this->key));
     $cipher->setIV(base64_decode($this->iv));
     return base64_encode($cipher->encrypt($text));
 }
開發者ID:ondrs,項目名稱:otomoto-api,代碼行數:14,代碼來源:Api.php

示例2: decrypt

 /**
  * Decrypt the ciphertext
  * @param string $cipherText
  * @return object \stdClass Unserialized token
  */
 public function decrypt($cipherText)
 {
     // Decryption: prefer mcrypt, if available (since it can decrypt data encrypted by either mcrypt or phpseclib)
     $cipherText = base64_decode($cipherText);
     $iv = substr($cipherText, 0, self::IV_SIZE);
     $cipherText = substr($cipherText, self::IV_SIZE);
     if (function_exists('mcrypt_decrypt')) {
         $token = @mcrypt_decrypt(MCRYPT_RIJNDAEL_128, $this->key, $cipherText, MCRYPT_MODE_CBC, $iv);
     } else {
         global $updraftplus;
         $updraftplus->ensure_phpseclib('Crypt_Rijndael', 'Crypt/Rijndael');
         $rijndael = new Crypt_Rijndael();
         $rijndael->setKey($this->key);
         $rijndael->setIV($iv);
         $token = $rijndael->decrypt($cipherText);
     }
     return $token;
 }
開發者ID:jesusmarket,項目名稱:jesusmarket,代碼行數:23,代碼來源:Encrypter.php

示例3: setIV

 /**
  * Sets the initialization vector. (optional)
  *
  * SetIV is not required when CRYPT_RIJNDAEL_MODE_ECB is being used.  If not explictly set, it'll be assumed
  * to be all zero's.
  *
  * @access public
  * @param String $iv
  */
 function setIV($iv)
 {
     parent::setIV($iv);
     if (CRYPT_AES_MODE == CRYPT_AES_MODE_MCRYPT) {
         $this->changed = true;
     }
 }
開發者ID:bbspike,項目名稱:sentora-core,代碼行數:16,代碼來源:AES.php

示例4: hash

 function osc_decrypt_alert($string) {
     $key = hash("sha256", osc_get_alert_private_key(), true);
     if(function_exists('mcrypt_module_open')) {
         $cipher = mcrypt_module_open(MCRYPT_RIJNDAEL_256, '', MCRYPT_MODE_CBC, '');
         $cipherText = '';
         if (mcrypt_generic_init($cipher, $key, $key) != -1) {
             $cipherText = mdecrypt_generic($cipher, $string);
             mcrypt_generic_deinit($cipher);
         }
         return trim(substr($cipherText, 32));
     };
     require_once LIB_PATH . 'phpseclib/Crypt/Rijndael.php';
     $cipher = new Crypt_Rijndael(CRYPT_RIJNDAEL_MODE_CBC);
     $cipher->disablePadding();
     $cipher->setBlockLength(256);
     $cipher->setKey($key);
     $cipher->setIV($key);
     return trim(substr($cipher->decrypt($string), 32));
 }
開發者ID:pombredanne,項目名稱:ArcherSys,代碼行數:19,代碼來源:hSecurity.php


注:本文中的Crypt_Rijndael::setIV方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。