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


PHP Crypt_Rijndael::__construct方法代码示例

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


在下文中一共展示了Crypt_Rijndael::__construct方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1:

 /**
  * Default Constructor.
  *
  * Determines whether or not the mcrypt extension should be used.
  *
  * $mode could be:
  *
  * - CRYPT_AES_MODE_ECB
  *
  * - CRYPT_AES_MODE_CBC
  *
  * - CRYPT_AES_MODE_CTR
  *
  * - CRYPT_AES_MODE_CFB
  *
  * - CRYPT_AES_MODE_OFB
  *
  * If not explictly set, CRYPT_AES_MODE_CBC will be used.
  *
  * @see Crypt_Rijndael::Crypt_Rijndael()
  * @see Crypt_Base::Crypt_Base()
  * @param optional Integer $mode
  * @access public
  */
 function __construct($mode = CRYPT_AES_MODE_CBC)
 {
     parent::__construct($mode);
 }
开发者ID:kevinlovesing,项目名称:dokuwiki,代码行数:28,代码来源:Crypt_AES.php

示例2: switch

 /**
  * Default Constructor.
  *
  * Determines whether or not the mcrypt extension should be used. $mode should only, at present, be
  * CRYPT_AES_MODE_ECB or CRYPT_AES_MODE_CBC. If not explictly set, CRYPT_AES_MODE_CBC will be used.
  *
  * @param
  *        	optional Integer $mode
  * @return Crypt_AES
  * @access public
  */
 function __construct($mode = CRYPT_AES_MODE_CBC)
 {
     if (!defined('CRYPT_AES_MODE')) {
         switch (true) {
             case extension_loaded('mcrypt'):
                 // i'd check to see if aes was supported, by doing in_array('des', mcrypt_list_algorithms('')),
                 // but since that can be changed after the object has been created, there doesn't seem to be
                 // a lot of point...
                 define('CRYPT_AES_MODE', CRYPT_AES_MODE_MCRYPT);
                 break;
             default:
                 define('CRYPT_AES_MODE', CRYPT_AES_MODE_INTERNAL);
         }
     }
     switch (CRYPT_AES_MODE) {
         case CRYPT_AES_MODE_MCRYPT:
             switch ($mode) {
                 case CRYPT_AES_MODE_ECB:
                     $this->paddable = true;
                     $this->mode = MCRYPT_MODE_ECB;
                     break;
                 case CRYPT_AES_MODE_CTR:
                     // ctr doesn't have a constant associated with it even though it appears to be fairly widely
                     // supported. in lieu of knowing just how widely supported it is, i've, for now, opted not to
                     // include a compatibility layer. the layer has been implemented but, for now, is commented out.
                     $this->mode = 'ctr';
                     // $this->mode = in_array('ctr', mcrypt_list_modes()) ? 'ctr' : CRYPT_AES_MODE_CTR;
                     break;
                 case CRYPT_AES_MODE_CFB:
                     $this->mode = 'ncfb';
                     break;
                 case CRYPT_AES_MODE_OFB:
                     $this->mode = MCRYPT_MODE_NOFB;
                     break;
                 case CRYPT_AES_MODE_CBC:
                 default:
                     $this->paddable = true;
                     $this->mode = MCRYPT_MODE_CBC;
             }
             $this->debuffer = $this->enbuffer = '';
             break;
         default:
             switch ($mode) {
                 case CRYPT_AES_MODE_ECB:
                     $this->paddable = true;
                     $this->mode = CRYPT_RIJNDAEL_MODE_ECB;
                     break;
                 case CRYPT_AES_MODE_CTR:
                     $this->mode = CRYPT_RIJNDAEL_MODE_CTR;
                     break;
                 case CRYPT_AES_MODE_CFB:
                     $this->mode = CRYPT_RIJNDAEL_MODE_CFB;
                     break;
                 case CRYPT_AES_MODE_OFB:
                     $this->mode = CRYPT_RIJNDAEL_MODE_OFB;
                     break;
                 case CRYPT_AES_MODE_CBC:
                 default:
                     $this->paddable = true;
                     $this->mode = CRYPT_RIJNDAEL_MODE_CBC;
             }
     }
     if (CRYPT_AES_MODE == CRYPT_AES_MODE_INTERNAL) {
         parent::__construct($this->mode);
     }
 }
开发者ID:vienbk91,项目名称:fuelphp17,代码行数:77,代码来源:AES.php


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