@@ -107,14 +107,14 @@ |
||
107 | 107 | return $resu; |
108 | 108 | } |
109 | 109 | |
110 | - /** |
|
111 | - * @author Sebastien Piraux <[email protected]> |
|
112 | - * @param sql : a sql query (as a string) |
|
113 | - * @return hours_array |
|
114 | - * @desc Return an assoc array. Keys are the hours, values are |
|
115 | - * the number of time this hours was found. |
|
116 | - * key 'total' return the sum of all number of time hours |
|
117 | - * appear |
|
110 | + /** |
|
111 | + * @author Sebastien Piraux <[email protected]> |
|
112 | + * @param sql : a sql query (as a string) |
|
113 | + * @return hours_array |
|
114 | + * @desc Return an assoc array. Keys are the hours, values are |
|
115 | + * the number of time this hours was found. |
|
116 | + * key 'total' return the sum of all number of time hours |
|
117 | + * appear |
|
118 | 118 | */ |
119 | 119 | public static function hoursTab($sql) |
120 | 120 | { |
@@ -5,42 +5,42 @@ |
||
5 | 5 | * @deprecated Don't use this class |
6 | 6 | */ |
7 | 7 | class Rights { |
8 | - private static $rights_cache = array(); |
|
9 | - private static $rights = array ( |
|
10 | - 'show_tabs:reports' => |
|
11 | - array ( |
|
12 | - 'type' => 'const', |
|
13 | - 'const' => 'true' ) |
|
14 | - ); |
|
8 | + private static $rights_cache = array(); |
|
9 | + private static $rights = array ( |
|
10 | + 'show_tabs:reports' => |
|
11 | + array ( |
|
12 | + 'type' => 'const', |
|
13 | + 'const' => 'true' ) |
|
14 | + ); |
|
15 | 15 | |
16 | - // warning the goal of this function is to enforce rights managment in Chamilo |
|
17 | - // thus default return value is always true |
|
18 | - public static function hasRight($handler) { |
|
19 | - if (array_key_exists($handler, self::$rights_cache)) |
|
20 | - return self::$rights_cache[$handler]; |
|
16 | + // warning the goal of this function is to enforce rights managment in Chamilo |
|
17 | + // thus default return value is always true |
|
18 | + public static function hasRight($handler) { |
|
19 | + if (array_key_exists($handler, self::$rights_cache)) |
|
20 | + return self::$rights_cache[$handler]; |
|
21 | 21 | |
22 | - if (!array_key_exists($handler, self::$rights)) |
|
23 | - return true; // handler does not exists |
|
22 | + if (!array_key_exists($handler, self::$rights)) |
|
23 | + return true; // handler does not exists |
|
24 | 24 | |
25 | - if (self::$rights[$handler]['type'] == 'sql') { |
|
26 | - $result = Database::query(self::$rights[$handler]['sql']); |
|
27 | - if (Database::num_rows($result) > 0) |
|
28 | - $result = true; |
|
29 | - else |
|
30 | - $result = false; |
|
31 | - } else if (self::$rights[$handler]['type'] == 'const') |
|
32 | - $result = self::$rights[$handler]['const']; |
|
33 | - else if (self::$rights[$handler]['type'] == 'func') |
|
34 | - $result = self::$rights[$handler]['func'](); |
|
35 | - else // handler type not implemented |
|
36 | - return true; |
|
37 | - self::$rights_cache[$handler] = $result; |
|
38 | - return $result; |
|
39 | - } |
|
25 | + if (self::$rights[$handler]['type'] == 'sql') { |
|
26 | + $result = Database::query(self::$rights[$handler]['sql']); |
|
27 | + if (Database::num_rows($result) > 0) |
|
28 | + $result = true; |
|
29 | + else |
|
30 | + $result = false; |
|
31 | + } else if (self::$rights[$handler]['type'] == 'const') |
|
32 | + $result = self::$rights[$handler]['const']; |
|
33 | + else if (self::$rights[$handler]['type'] == 'func') |
|
34 | + $result = self::$rights[$handler]['func'](); |
|
35 | + else // handler type not implemented |
|
36 | + return true; |
|
37 | + self::$rights_cache[$handler] = $result; |
|
38 | + return $result; |
|
39 | + } |
|
40 | 40 | |
41 | - public static function hasRightClosePageWithError($handler) { |
|
42 | - if (hasRight($handler) == false) |
|
43 | - die("You are not allowed here"); //FIXME |
|
44 | - } |
|
41 | + public static function hasRightClosePageWithError($handler) { |
|
42 | + if (hasRight($handler) == false) |
|
43 | + die("You are not allowed here"); //FIXME |
|
44 | + } |
|
45 | 45 | |
46 | 46 | } |
@@ -173,9 +173,9 @@ discard block |
||
173 | 173 | } |
174 | 174 | |
175 | 175 | /** |
176 | - * @param string $pluginName |
|
177 | - * @param int $urlId |
|
178 | - */ |
|
176 | + * @param string $pluginName |
|
177 | + * @param int $urlId |
|
178 | + */ |
|
179 | 179 | public function uninstall($pluginName, $urlId = null) |
180 | 180 | { |
181 | 181 | if (empty($urlId)) { |
@@ -252,12 +252,12 @@ discard block |
||
252 | 252 | } |
253 | 253 | |
254 | 254 | /** |
255 | - * @param string $region |
|
256 | - * @param string $template |
|
257 | - * @param bool $forced |
|
258 | - * |
|
259 | - * @return null|string |
|
260 | - */ |
|
255 | + * @param string $region |
|
256 | + * @param string $template |
|
257 | + * @param bool $forced |
|
258 | + * |
|
259 | + * @return null|string |
|
260 | + */ |
|
261 | 261 | public function load_region($region, $template, $forced = false) |
262 | 262 | { |
263 | 263 | if ($region == 'course_tool_plugin') { |
@@ -167,9 +167,9 @@ |
||
167 | 167 | ini_set('session.use_cookies', $old_use_cookies); |
168 | 168 | session_cache_limiter($old_session_cache_limiter); |
169 | 169 | } else { |
170 | - if (isset($_OLD_SESSION)) { |
|
171 | - $_SESSION = $_OLD_SESSION; |
|
172 | - unset($_OLD_SESSION); |
|
170 | + if (isset($_OLD_SESSION)) { |
|
171 | + $_SESSION = $_OLD_SESSION; |
|
172 | + unset($_OLD_SESSION); |
|
173 | 173 | } else { |
174 | 174 | unset($_SESSION); |
175 | 175 | } |
@@ -257,27 +257,27 @@ discard block |
||
257 | 257 | switch ($hash) { |
258 | 258 | case 'md2': |
259 | 259 | $this->b = 16; |
260 | - $this->hash = array($this, '_md2'); |
|
261 | - break; |
|
260 | + $this->hash = array($this, '_md2'); |
|
261 | + break; |
|
262 | 262 | case 'md5': |
263 | 263 | case 'md5-96': |
264 | 264 | $this->b = 64; |
265 | - $this->hash = array($this, '_md5'); |
|
266 | - break; |
|
265 | + $this->hash = array($this, '_md5'); |
|
266 | + break; |
|
267 | 267 | case 'sha256': |
268 | 268 | $this->b = 64; |
269 | - $this->hash = array($this, '_sha256'); |
|
270 | - break; |
|
269 | + $this->hash = array($this, '_sha256'); |
|
270 | + break; |
|
271 | 271 | case 'sha384': |
272 | 272 | case 'sha512': |
273 | 273 | $this->b = 128; |
274 | - $this->hash = array($this, '_sha512'); |
|
275 | - break; |
|
274 | + $this->hash = array($this, '_sha512'); |
|
275 | + break; |
|
276 | 276 | case 'sha1': |
277 | 277 | case 'sha1-96': |
278 | 278 | default: |
279 | 279 | $this->b = 64; |
280 | - $this->hash = array($this, '_sha1'); |
|
280 | + $this->hash = array($this, '_sha1'); |
|
281 | 281 | } |
282 | 282 | |
283 | 283 | $this->ipad = str_repeat(chr(0x36), $this->b); |
@@ -378,24 +378,24 @@ discard block |
||
378 | 378 | function _md2($m) |
379 | 379 | { |
380 | 380 | static $s = array( |
381 | - 41, 46, 67, 201, 162, 216, 124, 1, 61, 54, 84, 161, 236, 240, 6, |
|
382 | - 19, 98, 167, 5, 243, 192, 199, 115, 140, 152, 147, 43, 217, 188, |
|
383 | - 76, 130, 202, 30, 155, 87, 60, 253, 212, 224, 22, 103, 66, 111, 24, |
|
381 | + 41, 46, 67, 201, 162, 216, 124, 1, 61, 54, 84, 161, 236, 240, 6, |
|
382 | + 19, 98, 167, 5, 243, 192, 199, 115, 140, 152, 147, 43, 217, 188, |
|
383 | + 76, 130, 202, 30, 155, 87, 60, 253, 212, 224, 22, 103, 66, 111, 24, |
|
384 | 384 | 138, 23, 229, 18, 190, 78, 196, 214, 218, 158, 222, 73, 160, 251, |
385 | 385 | 245, 142, 187, 47, 238, 122, 169, 104, 121, 145, 21, 178, 7, 63, |
386 | 386 | 148, 194, 16, 137, 11, 34, 95, 33, 128, 127, 93, 154, 90, 144, 50, |
387 | - 39, 53, 62, 204, 231, 191, 247, 151, 3, 255, 25, 48, 179, 72, 165, |
|
387 | + 39, 53, 62, 204, 231, 191, 247, 151, 3, 255, 25, 48, 179, 72, 165, |
|
388 | 388 | 181, 209, 215, 94, 146, 42, 172, 86, 170, 198, 79, 184, 56, 210, |
389 | 389 | 150, 164, 125, 182, 118, 252, 107, 226, 156, 116, 4, 241, 69, 157, |
390 | 390 | 112, 89, 100, 113, 135, 32, 134, 91, 207, 101, 230, 45, 168, 2, 27, |
391 | - 96, 37, 173, 174, 176, 185, 246, 28, 70, 97, 105, 52, 64, 126, 15, |
|
392 | - 85, 71, 163, 35, 221, 81, 175, 58, 195, 92, 249, 206, 186, 197, |
|
391 | + 96, 37, 173, 174, 176, 185, 246, 28, 70, 97, 105, 52, 64, 126, 15, |
|
392 | + 85, 71, 163, 35, 221, 81, 175, 58, 195, 92, 249, 206, 186, 197, |
|
393 | 393 | 234, 38, 44, 83, 13, 110, 133, 40, 132, 9, 211, 223, 205, 244, 65, |
394 | 394 | 129, 77, 82, 106, 220, 55, 200, 108, 193, 171, 250, 36, 225, 123, |
395 | - 8, 12, 189, 177, 74, 120, 136, 149, 139, 227, 99, 232, 109, 233, |
|
395 | + 8, 12, 189, 177, 74, 120, 136, 149, 139, 227, 99, 232, 109, 233, |
|
396 | 396 | 203, 213, 254, 59, 0, 29, 57, 242, 239, 183, 14, 102, 88, 208, 228, |
397 | 397 | 166, 119, 114, 248, 235, 117, 75, 10, 49, 68, 80, 180, 143, 237, |
398 | - 31, 26, 219, 153, 141, 51, 159, 17, 131, 20 |
|
398 | + 31, 26, 219, 153, 141, 51, 159, 17, 131, 20 |
|
399 | 399 | ); |
400 | 400 | |
401 | 401 | // Step 1. Append Padding Bytes |
@@ -494,11 +494,11 @@ discard block |
||
494 | 494 | // Extend the sixteen 32-bit words into sixty-four 32-bit words |
495 | 495 | for ($i = 16; $i < 64; $i++) { |
496 | 496 | $s0 = $this->_rightRotate($w[$i - 15], 7) ^ |
497 | - $this->_rightRotate($w[$i - 15], 18) ^ |
|
498 | - $this->_rightShift( $w[$i - 15], 3); |
|
497 | + $this->_rightRotate($w[$i - 15], 18) ^ |
|
498 | + $this->_rightShift( $w[$i - 15], 3); |
|
499 | 499 | $s1 = $this->_rightRotate($w[$i - 2], 17) ^ |
500 | - $this->_rightRotate($w[$i - 2], 19) ^ |
|
501 | - $this->_rightShift( $w[$i - 2], 10); |
|
500 | + $this->_rightRotate($w[$i - 2], 19) ^ |
|
501 | + $this->_rightShift( $w[$i - 2], 10); |
|
502 | 502 | $w[$i] = $this->_add($w[$i - 16], $s0, $w[$i - 7], $s1); |
503 | 503 | |
504 | 504 | } |
@@ -509,18 +509,18 @@ discard block |
||
509 | 509 | // Main loop |
510 | 510 | for ($i = 0; $i < 64; $i++) { |
511 | 511 | $s0 = $this->_rightRotate($a, 2) ^ |
512 | - $this->_rightRotate($a, 13) ^ |
|
513 | - $this->_rightRotate($a, 22); |
|
512 | + $this->_rightRotate($a, 13) ^ |
|
513 | + $this->_rightRotate($a, 22); |
|
514 | 514 | $maj = ($a & $b) ^ |
515 | - ($a & $c) ^ |
|
516 | - ($b & $c); |
|
515 | + ($a & $c) ^ |
|
516 | + ($b & $c); |
|
517 | 517 | $t2 = $this->_add($s0, $maj); |
518 | 518 | |
519 | 519 | $s1 = $this->_rightRotate($e, 6) ^ |
520 | - $this->_rightRotate($e, 11) ^ |
|
521 | - $this->_rightRotate($e, 25); |
|
520 | + $this->_rightRotate($e, 11) ^ |
|
521 | + $this->_rightRotate($e, 25); |
|
522 | 522 | $ch = ($e & $f) ^ |
523 | - ($this->_not($e) & $g); |
|
523 | + ($this->_not($e) & $g); |
|
524 | 524 | $t1 = $this->_add($h, $s1, $ch, $k[$i], $w[$i]); |
525 | 525 | |
526 | 526 | $h = $g; |
@@ -635,16 +635,16 @@ discard block |
||
635 | 635 | // Extend the sixteen 32-bit words into eighty 32-bit words |
636 | 636 | for ($i = 16; $i < 80; $i++) { |
637 | 637 | $temp = array( |
638 | - $w[$i - 15]->bitwise_rightRotate(1), |
|
639 | - $w[$i - 15]->bitwise_rightRotate(8), |
|
640 | - $w[$i - 15]->bitwise_rightShift(7) |
|
638 | + $w[$i - 15]->bitwise_rightRotate(1), |
|
639 | + $w[$i - 15]->bitwise_rightRotate(8), |
|
640 | + $w[$i - 15]->bitwise_rightShift(7) |
|
641 | 641 | ); |
642 | 642 | $s0 = $temp[0]->bitwise_xor($temp[1]); |
643 | 643 | $s0 = $s0->bitwise_xor($temp[2]); |
644 | 644 | $temp = array( |
645 | - $w[$i - 2]->bitwise_rightRotate(19), |
|
646 | - $w[$i - 2]->bitwise_rightRotate(61), |
|
647 | - $w[$i - 2]->bitwise_rightShift(6) |
|
645 | + $w[$i - 2]->bitwise_rightRotate(19), |
|
646 | + $w[$i - 2]->bitwise_rightRotate(61), |
|
647 | + $w[$i - 2]->bitwise_rightShift(6) |
|
648 | 648 | ); |
649 | 649 | $s1 = $temp[0]->bitwise_xor($temp[1]); |
650 | 650 | $s1 = $s1->bitwise_xor($temp[2]); |
@@ -625,13 +625,13 @@ |
||
625 | 625 | $l^= $p[++$i]; |
626 | 626 | $r^= ($sb_0[$l >> 24 & 0xff] + |
627 | 627 | $sb_1[$l >> 16 & 0xff] ^ |
628 | - $sb_2[$l >> 8 & 0xff]) + |
|
628 | + $sb_2[$l >> 8 & 0xff]) + |
|
629 | 629 | $sb_3[$l & 0xff]; |
630 | 630 | |
631 | 631 | $r^= $p[++$i]; |
632 | 632 | $l^= ($sb_0[$r >> 24 & 0xff] + |
633 | 633 | $sb_1[$r >> 16 & 0xff] ^ |
634 | - $sb_2[$r >> 8 & 0xff]) + |
|
634 | + $sb_2[$r >> 8 & 0xff]) + |
|
635 | 635 | $sb_3[$r & 0xff]; |
636 | 636 | |
637 | 637 | } |
@@ -1137,7 +1137,7 @@ discard block |
||
1137 | 1137 | if ($this->continuousBuffer) { |
1138 | 1138 | $this->encryptIV = $xor; |
1139 | 1139 | if ($start = strlen($plaintext) & 7) { |
1140 | - $buffer['xor'] = substr($key, $start) . $buffer['xor']; |
|
1140 | + $buffer['xor'] = substr($key, $start) . $buffer['xor']; |
|
1141 | 1141 | } |
1142 | 1142 | } |
1143 | 1143 | } |
@@ -1332,7 +1332,7 @@ discard block |
||
1332 | 1332 | if ($this->continuousBuffer) { |
1333 | 1333 | $this->decryptIV = $xor; |
1334 | 1334 | if ($start = strlen($ciphertext) % 8) { |
1335 | - $buffer['xor'] = substr($key, $start) . $buffer['xor']; |
|
1335 | + $buffer['xor'] = substr($key, $start) . $buffer['xor']; |
|
1336 | 1336 | } |
1337 | 1337 | } |
1338 | 1338 | } |
@@ -1518,13 +1518,13 @@ discard block |
||
1518 | 1518 | $t = unpack('Nl/Nr', $block); |
1519 | 1519 | list($l, $r) = array($t['l'], $t['r']); |
1520 | 1520 | $block = ($shuffle[$ipmap[$r & 0xFF]] & "\x80\x80\x80\x80\x80\x80\x80\x80") | |
1521 | - ($shuffle[$ipmap[($r >> 8) & 0xFF]] & "\x40\x40\x40\x40\x40\x40\x40\x40") | |
|
1522 | - ($shuffle[$ipmap[($r >> 16) & 0xFF]] & "\x20\x20\x20\x20\x20\x20\x20\x20") | |
|
1523 | - ($shuffle[$ipmap[($r >> 24) & 0xFF]] & "\x10\x10\x10\x10\x10\x10\x10\x10") | |
|
1524 | - ($shuffle[$ipmap[$l & 0xFF]] & "\x08\x08\x08\x08\x08\x08\x08\x08") | |
|
1525 | - ($shuffle[$ipmap[($l >> 8) & 0xFF]] & "\x04\x04\x04\x04\x04\x04\x04\x04") | |
|
1526 | - ($shuffle[$ipmap[($l >> 16) & 0xFF]] & "\x02\x02\x02\x02\x02\x02\x02\x02") | |
|
1527 | - ($shuffle[$ipmap[($l >> 24) & 0xFF]] & "\x01\x01\x01\x01\x01\x01\x01\x01"); |
|
1521 | + ($shuffle[$ipmap[($r >> 8) & 0xFF]] & "\x40\x40\x40\x40\x40\x40\x40\x40") | |
|
1522 | + ($shuffle[$ipmap[($r >> 16) & 0xFF]] & "\x20\x20\x20\x20\x20\x20\x20\x20") | |
|
1523 | + ($shuffle[$ipmap[($r >> 24) & 0xFF]] & "\x10\x10\x10\x10\x10\x10\x10\x10") | |
|
1524 | + ($shuffle[$ipmap[$l & 0xFF]] & "\x08\x08\x08\x08\x08\x08\x08\x08") | |
|
1525 | + ($shuffle[$ipmap[($l >> 8) & 0xFF]] & "\x04\x04\x04\x04\x04\x04\x04\x04") | |
|
1526 | + ($shuffle[$ipmap[($l >> 16) & 0xFF]] & "\x02\x02\x02\x02\x02\x02\x02\x02") | |
|
1527 | + ($shuffle[$ipmap[($l >> 24) & 0xFF]] & "\x01\x01\x01\x01\x01\x01\x01\x01"); |
|
1528 | 1528 | |
1529 | 1529 | // Extract L0 and R0. |
1530 | 1530 | $t = unpack('Nl/Nr', $block); |
@@ -1540,9 +1540,9 @@ discard block |
||
1540 | 1540 | |
1541 | 1541 | // S-box indexing. |
1542 | 1542 | $t = $sbox1[($b1 >> 24) & 0x3F] ^ $sbox2[($b2 >> 24) & 0x3F] ^ |
1543 | - $sbox3[($b1 >> 16) & 0x3F] ^ $sbox4[($b2 >> 16) & 0x3F] ^ |
|
1544 | - $sbox5[($b1 >> 8) & 0x3F] ^ $sbox6[($b2 >> 8) & 0x3F] ^ |
|
1545 | - $sbox7[$b1 & 0x3F] ^ $sbox8[$b2 & 0x3F] ^ $l; |
|
1543 | + $sbox3[($b1 >> 16) & 0x3F] ^ $sbox4[($b2 >> 16) & 0x3F] ^ |
|
1544 | + $sbox5[($b1 >> 8) & 0x3F] ^ $sbox6[($b2 >> 8) & 0x3F] ^ |
|
1545 | + $sbox7[$b1 & 0x3F] ^ $sbox8[$b2 & 0x3F] ^ $l; |
|
1546 | 1546 | // end of "the Feistel (F) function" |
1547 | 1547 | |
1548 | 1548 | $l = $r; |
@@ -1551,13 +1551,13 @@ discard block |
||
1551 | 1551 | |
1552 | 1552 | // Perform the inverse IP permutation. |
1553 | 1553 | return ($shuffle[$invipmap[($l >> 24) & 0xFF]] & "\x80\x80\x80\x80\x80\x80\x80\x80") | |
1554 | - ($shuffle[$invipmap[($r >> 24) & 0xFF]] & "\x40\x40\x40\x40\x40\x40\x40\x40") | |
|
1555 | - ($shuffle[$invipmap[($l >> 16) & 0xFF]] & "\x20\x20\x20\x20\x20\x20\x20\x20") | |
|
1556 | - ($shuffle[$invipmap[($r >> 16) & 0xFF]] & "\x10\x10\x10\x10\x10\x10\x10\x10") | |
|
1557 | - ($shuffle[$invipmap[($l >> 8) & 0xFF]] & "\x08\x08\x08\x08\x08\x08\x08\x08") | |
|
1558 | - ($shuffle[$invipmap[($r >> 8) & 0xFF]] & "\x04\x04\x04\x04\x04\x04\x04\x04") | |
|
1559 | - ($shuffle[$invipmap[$l & 0xFF]] & "\x02\x02\x02\x02\x02\x02\x02\x02") | |
|
1560 | - ($shuffle[$invipmap[$r & 0xFF]] & "\x01\x01\x01\x01\x01\x01\x01\x01"); |
|
1554 | + ($shuffle[$invipmap[($r >> 24) & 0xFF]] & "\x40\x40\x40\x40\x40\x40\x40\x40") | |
|
1555 | + ($shuffle[$invipmap[($l >> 16) & 0xFF]] & "\x20\x20\x20\x20\x20\x20\x20\x20") | |
|
1556 | + ($shuffle[$invipmap[($r >> 16) & 0xFF]] & "\x10\x10\x10\x10\x10\x10\x10\x10") | |
|
1557 | + ($shuffle[$invipmap[($l >> 8) & 0xFF]] & "\x08\x08\x08\x08\x08\x08\x08\x08") | |
|
1558 | + ($shuffle[$invipmap[($r >> 8) & 0xFF]] & "\x04\x04\x04\x04\x04\x04\x04\x04") | |
|
1559 | + ($shuffle[$invipmap[$l & 0xFF]] & "\x02\x02\x02\x02\x02\x02\x02\x02") | |
|
1560 | + ($shuffle[$invipmap[$r & 0xFF]] & "\x01\x01\x01\x01\x01\x01\x01\x01"); |
|
1561 | 1561 | } |
1562 | 1562 | |
1563 | 1563 | /** |
@@ -2025,13 +2025,13 @@ discard block |
||
2025 | 2025 | $t = unpack('Nl/Nr', $key); |
2026 | 2026 | list($l, $r) = array($t['l'], $t['r']); |
2027 | 2027 | $key = ($this->shuffle[$pc1map[$r & 0xFF]] & "\x80\x80\x80\x80\x80\x80\x80\x00") | |
2028 | - ($this->shuffle[$pc1map[($r >> 8) & 0xFF]] & "\x40\x40\x40\x40\x40\x40\x40\x00") | |
|
2029 | - ($this->shuffle[$pc1map[($r >> 16) & 0xFF]] & "\x20\x20\x20\x20\x20\x20\x20\x00") | |
|
2030 | - ($this->shuffle[$pc1map[($r >> 24) & 0xFF]] & "\x10\x10\x10\x10\x10\x10\x10\x00") | |
|
2031 | - ($this->shuffle[$pc1map[$l & 0xFF]] & "\x08\x08\x08\x08\x08\x08\x08\x00") | |
|
2032 | - ($this->shuffle[$pc1map[($l >> 8) & 0xFF]] & "\x04\x04\x04\x04\x04\x04\x04\x00") | |
|
2033 | - ($this->shuffle[$pc1map[($l >> 16) & 0xFF]] & "\x02\x02\x02\x02\x02\x02\x02\x00") | |
|
2034 | - ($this->shuffle[$pc1map[($l >> 24) & 0xFF]] & "\x01\x01\x01\x01\x01\x01\x01\x00"); |
|
2028 | + ($this->shuffle[$pc1map[($r >> 8) & 0xFF]] & "\x40\x40\x40\x40\x40\x40\x40\x00") | |
|
2029 | + ($this->shuffle[$pc1map[($r >> 16) & 0xFF]] & "\x20\x20\x20\x20\x20\x20\x20\x00") | |
|
2030 | + ($this->shuffle[$pc1map[($r >> 24) & 0xFF]] & "\x10\x10\x10\x10\x10\x10\x10\x00") | |
|
2031 | + ($this->shuffle[$pc1map[$l & 0xFF]] & "\x08\x08\x08\x08\x08\x08\x08\x00") | |
|
2032 | + ($this->shuffle[$pc1map[($l >> 8) & 0xFF]] & "\x04\x04\x04\x04\x04\x04\x04\x00") | |
|
2033 | + ($this->shuffle[$pc1map[($l >> 16) & 0xFF]] & "\x02\x02\x02\x02\x02\x02\x02\x00") | |
|
2034 | + ($this->shuffle[$pc1map[($l >> 24) & 0xFF]] & "\x01\x01\x01\x01\x01\x01\x01\x00"); |
|
2035 | 2035 | $key = unpack('Nc/Nd', $key); |
2036 | 2036 | $c = ($key['c'] >> 4) & 0x0FFFFFFF; |
2037 | 2037 | $d = (($key['d'] >> 4) & 0x0FFFFFF0) | ($key['c'] & 0x0F); |
@@ -2045,9 +2045,9 @@ discard block |
||
2045 | 2045 | |
2046 | 2046 | // Perform the PC-2 transformation. |
2047 | 2047 | $cp = $pc2mapc1[$c >> 24] | $pc2mapc2[($c >> 16) & 0xFF] | |
2048 | - $pc2mapc3[($c >> 8) & 0xFF] | $pc2mapc4[$c & 0xFF]; |
|
2048 | + $pc2mapc3[($c >> 8) & 0xFF] | $pc2mapc4[$c & 0xFF]; |
|
2049 | 2049 | $dp = $pc2mapd1[$d >> 24] | $pc2mapd2[($d >> 16) & 0xFF] | |
2050 | - $pc2mapd3[($d >> 8) & 0xFF] | $pc2mapd4[$d & 0xFF]; |
|
2050 | + $pc2mapd3[($d >> 8) & 0xFF] | $pc2mapd4[$d & 0xFF]; |
|
2051 | 2051 | |
2052 | 2052 | // Reorder: odd bytes/even bytes. Push the result in key schedule. |
2053 | 2053 | $keys[] = array( |
@@ -703,15 +703,15 @@ discard block |
||
703 | 703 | return false; |
704 | 704 | } |
705 | 705 | return "<RSAKeyValue>\r\n" . |
706 | - ' <Modulus>' . base64_encode($raw['modulus']) . "</Modulus>\r\n" . |
|
707 | - ' <Exponent>' . base64_encode($raw['publicExponent']) . "</Exponent>\r\n" . |
|
708 | - ' <P>' . base64_encode($raw['prime1']) . "</P>\r\n" . |
|
709 | - ' <Q>' . base64_encode($raw['prime2']) . "</Q>\r\n" . |
|
710 | - ' <DP>' . base64_encode($raw['exponent1']) . "</DP>\r\n" . |
|
711 | - ' <DQ>' . base64_encode($raw['exponent2']) . "</DQ>\r\n" . |
|
712 | - ' <InverseQ>' . base64_encode($raw['coefficient']) . "</InverseQ>\r\n" . |
|
713 | - ' <D>' . base64_encode($raw['privateExponent']) . "</D>\r\n" . |
|
714 | - '</RSAKeyValue>'; |
|
706 | + ' <Modulus>' . base64_encode($raw['modulus']) . "</Modulus>\r\n" . |
|
707 | + ' <Exponent>' . base64_encode($raw['publicExponent']) . "</Exponent>\r\n" . |
|
708 | + ' <P>' . base64_encode($raw['prime1']) . "</P>\r\n" . |
|
709 | + ' <Q>' . base64_encode($raw['prime2']) . "</Q>\r\n" . |
|
710 | + ' <DP>' . base64_encode($raw['exponent1']) . "</DP>\r\n" . |
|
711 | + ' <DQ>' . base64_encode($raw['exponent2']) . "</DQ>\r\n" . |
|
712 | + ' <InverseQ>' . base64_encode($raw['coefficient']) . "</InverseQ>\r\n" . |
|
713 | + ' <D>' . base64_encode($raw['privateExponent']) . "</D>\r\n" . |
|
714 | + '</RSAKeyValue>'; |
|
715 | 715 | break; |
716 | 716 | case CRYPT_RSA_PRIVATE_FORMAT_PUTTY: |
717 | 717 | if ($num_primes != 2) { |
@@ -725,8 +725,8 @@ discard block |
||
725 | 725 | strlen('ssh-rsa'), 'ssh-rsa', strlen($raw['publicExponent']), $raw['publicExponent'], strlen($raw['modulus']), $raw['modulus'] |
726 | 726 | ); |
727 | 727 | $source = pack('Na*Na*Na*Na*', |
728 | - strlen('ssh-rsa'), 'ssh-rsa', strlen($encryption), $encryption, |
|
729 | - strlen($this->comment), $this->comment, strlen($public), $public |
|
728 | + strlen('ssh-rsa'), 'ssh-rsa', strlen($encryption), $encryption, |
|
729 | + strlen($this->comment), $this->comment, strlen($public), $public |
|
730 | 730 | ); |
731 | 731 | $public = base64_encode($public); |
732 | 732 | $key.= "Public-Lines: " . ((strlen($public) + 32) >> 6) . "\r\n"; |
@@ -810,15 +810,15 @@ discard block |
||
810 | 810 | $des->setIV($iv); |
811 | 811 | $iv = strtoupper(bin2hex($iv)); |
812 | 812 | $RSAPrivateKey = "-----BEGIN RSA PRIVATE KEY-----\r\n" . |
813 | - "Proc-Type: 4,ENCRYPTED\r\n" . |
|
814 | - "DEK-Info: DES-EDE3-CBC,$iv\r\n" . |
|
815 | - "\r\n" . |
|
816 | - chunk_split(base64_encode($des->encrypt($RSAPrivateKey)), 64) . |
|
817 | - '-----END RSA PRIVATE KEY-----'; |
|
813 | + "Proc-Type: 4,ENCRYPTED\r\n" . |
|
814 | + "DEK-Info: DES-EDE3-CBC,$iv\r\n" . |
|
815 | + "\r\n" . |
|
816 | + chunk_split(base64_encode($des->encrypt($RSAPrivateKey)), 64) . |
|
817 | + '-----END RSA PRIVATE KEY-----'; |
|
818 | 818 | } else { |
819 | 819 | $RSAPrivateKey = "-----BEGIN RSA PRIVATE KEY-----\r\n" . |
820 | - chunk_split(base64_encode($RSAPrivateKey), 64) . |
|
821 | - '-----END RSA PRIVATE KEY-----'; |
|
820 | + chunk_split(base64_encode($RSAPrivateKey), 64) . |
|
821 | + '-----END RSA PRIVATE KEY-----'; |
|
822 | 822 | } |
823 | 823 | |
824 | 824 | return $RSAPrivateKey; |
@@ -843,9 +843,9 @@ discard block |
||
843 | 843 | return array('e' => $e->copy(), 'n' => $n->copy()); |
844 | 844 | case CRYPT_RSA_PUBLIC_FORMAT_XML: |
845 | 845 | return "<RSAKeyValue>\r\n" . |
846 | - ' <Modulus>' . base64_encode($modulus) . "</Modulus>\r\n" . |
|
847 | - ' <Exponent>' . base64_encode($publicExponent) . "</Exponent>\r\n" . |
|
848 | - '</RSAKeyValue>'; |
|
846 | + ' <Modulus>' . base64_encode($modulus) . "</Modulus>\r\n" . |
|
847 | + ' <Exponent>' . base64_encode($publicExponent) . "</Exponent>\r\n" . |
|
848 | + '</RSAKeyValue>'; |
|
849 | 849 | break; |
850 | 850 | case CRYPT_RSA_PUBLIC_FORMAT_OPENSSH: |
851 | 851 | // from <http://tools.ietf.org/html/rfc4253#page-15>: |
@@ -884,8 +884,8 @@ discard block |
||
884 | 884 | } |
885 | 885 | |
886 | 886 | $RSAPublicKey = "-----BEGIN PUBLIC KEY-----\r\n" . |
887 | - chunk_split(base64_encode($RSAPublicKey), 64) . |
|
888 | - '-----END PUBLIC KEY-----'; |
|
887 | + chunk_split(base64_encode($RSAPublicKey), 64) . |
|
888 | + '-----END PUBLIC KEY-----'; |
|
889 | 889 | |
890 | 890 | return $RSAPublicKey; |
891 | 891 | } |
@@ -538,7 +538,7 @@ discard block |
||
538 | 538 | if ($this->continuousBuffer) { |
539 | 539 | $this->encryptIV = $xor; |
540 | 540 | if ($start = strlen($plaintext) & 7) { |
541 | - $buffer['xor'] = substr($key, $start) . $buffer['xor']; |
|
541 | + $buffer['xor'] = substr($key, $start) . $buffer['xor']; |
|
542 | 542 | } |
543 | 543 | } |
544 | 544 | } |
@@ -757,7 +757,7 @@ discard block |
||
757 | 757 | if ($this->continuousBuffer) { |
758 | 758 | $this->decryptIV = $xor; |
759 | 759 | if ($start = strlen($ciphertext) & 7) { |
760 | - $buffer['xor'] = substr($key, $start) . $buffer['xor']; |
|
760 | + $buffer['xor'] = substr($key, $start) . $buffer['xor']; |
|
761 | 761 | } |
762 | 762 | } |
763 | 763 | } |