Esempio n. 1
0
 /**
  * Default Constructor.
  *
  * Determines whether or not the mcrypt extension should be used.
  *
  * $mode could be:
  *
  * - \phpseclib\Crypt\Base::MODE_ECB
  *
  * - \phpseclib\Crypt\Base::MODE_CBC
  *
  * - \phpseclib\Crypt\Base::MODE_CTR
  *
  * - \phpseclib\Crypt\Base::MODE_CFB
  *
  * - \phpseclib\Crypt\Base::MODE_OFB
  *
  * - \phpseclib\Crypt\TripleDES::MODE_3CBC
  *
  * If not explicitly set, \phpseclib\Crypt\Base::MODE_CBC will be used.
  *
  * @see \phpseclib\Crypt\DES::__construct()
  * @see \phpseclib\Crypt\Base::__construct()
  * @param int $mode
  * @access public
  */
 function __construct($mode = Base::MODE_CBC)
 {
     switch ($mode) {
         // In case of self::MODE_3CBC, we init as CRYPT_DES_MODE_CBC
         // and additional flag us internally as 3CBC
         case self::MODE_3CBC:
             parent::__construct(Base::MODE_CBC);
             $this->mode_3cbc = true;
             // This three $des'es will do the 3CBC work (if $key > 64bits)
             $this->des = array(new DES(Base::MODE_CBC), new DES(Base::MODE_CBC), new DES(Base::MODE_CBC));
             // we're going to be doing the padding, ourselves, so disable it in the \phpseclib\Crypt\DES objects
             $this->des[0]->disablePadding();
             $this->des[1]->disablePadding();
             $this->des[2]->disablePadding();
             break;
             // If not 3CBC, we init as usual
         // If not 3CBC, we init as usual
         default:
             parent::__construct($mode);
     }
 }