Lines Matching defs:key

84      * max possible size of $key
142 // This three $des'es will do the 3CBC work (if $key > 64bits)
206 * Sets the key length.
208 * Valid key lengths are 128 and 192 bits.
210 * If you want to use a 64-bit key use DES.php
213 * @throws \LengthException if the key length is invalid
230 * Sets the key.
232 * Triple DES can use 128-bit (eg. strlen($key) == 16) or 192-bit (eg. strlen($key) == 24) keys.
238 * @throws \LengthException if the key length is invalid
239 * @param string $key
241 public function setKey($key)
243 if ($this->explicit_key_length !== false && strlen($key) != $this->explicit_key_length) {
244 throw new \LengthException('Key length has already been set to ' . $this->explicit_key_length . ' bytes and this key is ' . strlen($key) . ' bytes');
247 switch (strlen($key)) {
249 $key .= substr($key, 0, 8);
254 throw new \LengthException('Key of size ' . strlen($key) . ' not supported by this algorithm. Only keys of sizes 16 or 24 are supported');
258 $this->key = $key;
259 $this->key_length = strlen($key);
264 $this->des[0]->setKey(substr($key, 0, 8));
265 $this->des[1]->setKey(substr($key, 8, 8));
266 $this->des[2]->setKey(substr($key, 16, 8));
280 // except for: self::MODE_3CBC (inner chaining CBC) with a key > 64bits
282 // if the key is smaller then 8, do what we'd normally do
283 if ($this->mode_3cbc && strlen($this->key) > 8) {
305 if ($this->mode_3cbc && strlen($this->key) > 8) {
386 * Creates the key schedule
394 // if $key <= 64bits we configure our internal pure-php cipher engine
396 case strlen($this->key) <= 8:
400 // otherwise, if $key > 64bits, we configure our engine to work as 3DES.
411 // not need unnecessary stress parent::setupKey() with our, now unused, $key.
415 // setup our key