Пример #1
0
 /**
  * Sets the key length
  *
  * Valid key lengths are 128, 192, and 256.  If the length is less than 128, it will be rounded up to
  * 128.  If the length is greater than 128 and invalid, it will be rounded down to the closest valid amount.
  *
  * @see \phpseclib\Crypt\Rijndael:setKeyLength()
  * @access public
  * @param int $length
  */
 function setKeyLength($length)
 {
     switch ($length) {
         case 160:
             $length = 192;
             break;
         case 224:
             $length = 256;
     }
     parent::setKeyLength($length);
 }
Пример #2
0
 /**
  * Sets the key length
  *
  * Valid key lengths are 128, 192, and 256.  Set the link to bool(false) to disable a fixed key length
  *
  * @see \phpseclib\Crypt\Rijndael:setKeyLength()
  * @access public
  * @param int $length
  * @throws \LengthException if the key length isn't supported
  */
 function setKeyLength($length)
 {
     switch ($length) {
         case 128:
         case 192:
         case 256:
             break;
         default:
             throw new \LengthException('Key of size ' . $length . ' not supported by this algorithm. Only keys of sizes 128, 192 or 256 supported');
     }
     parent::setKeyLength($length);
 }