当前位置: 首页>>代码示例>>PHP>>正文


PHP Crypt_Rijndael::setBlockLength方法代码示例

本文整理汇总了PHP中Crypt_Rijndael::setBlockLength方法的典型用法代码示例。如果您正苦于以下问题:PHP Crypt_Rijndael::setBlockLength方法的具体用法?PHP Crypt_Rijndael::setBlockLength怎么用?PHP Crypt_Rijndael::setBlockLength使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Crypt_Rijndael的用法示例。


在下文中一共展示了Crypt_Rijndael::setBlockLength方法的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: init

 /**
  * Initilizes cryptographic scheme
  */
 private static function init()
 {
     if (is_null(self::$cryptographicScheme)) {
         $key = KeyHandler::readKey();
         $mysqlKey = "";
         for ($a = 0; $a < strlen($key); $a++) {
             $mysqlKey[$a % 16] = chr(ord($mysqlKey[$a % 16]) ^ ord($key[$a]));
         }
         $aes = new Crypt_Rijndael(CRYPT_RIJNDAEL_MODE_ECB);
         $aes->setKeyLength(128);
         $aes->setBlockLength(128);
         $aes->setKey($mysqlKey);
         self::$cryptographicScheme = $aes;
     }
 }
开发者ID:lahirwisada,项目名称:orangehrm,代码行数:18,代码来源:Cryptographer.php

示例3: 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

示例4: encrypt

 /**
  *
  * Encrypts given value, with given key, and hex encodes it before
  * returning.
  *
  * Compatible with mysql: "hex(aes_encrypt($val, $key))
  *
  * @param string $val - value to encrypt
  * @param string $ky - key
  * @return string encrypted value
  */
 public function encrypt($val, $key)
 {
     if (empty($val)) {
         return $val;
     }
     $mysqlKey = "";
     for ($a = 0; $a < strlen($key); $a++) {
         $mysqlKey[$a % 16] = chr(ord($mysqlKey[$a % 16]) ^ ord($key[$a]));
     }
     $aes = new Crypt_Rijndael(CRYPT_RIJNDAEL_MODE_ECB);
     $aes->setKeyLength(128);
     $aes->setBlockLength(128);
     $aes->setKey($mysqlKey);
     $encrypt = $aes->encrypt($val);
     $encrypt = strtoupper(bin2hex($encrypt));
     return $encrypt;
 }
开发者ID:lahirwisada,项目名称:orangehrm,代码行数:28,代码来源:EncryptionListener.php


注:本文中的Crypt_Rijndael::setBlockLength方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。