@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | if (api_is_allowed_to_edit()) { |
125 | 125 | $this->can_edit = true; |
126 | 126 | } else { |
127 | - if ($this->user_id == api_get_user_id()) { |
|
127 | + if ($this->user_id == api_get_user_id()) { |
|
128 | 128 | $this->can_edit = true; |
129 | 129 | } |
130 | 130 | } |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | { |
197 | 197 | $filename = null; |
198 | 198 | //@ugly fix |
199 | - foreach($this->available_extensions as $extension) { |
|
199 | + foreach ($this->available_extensions as $extension) { |
|
200 | 200 | $items = explode('-', $this->filename); |
201 | 201 | $items[5] = 'temp_exe'; |
202 | 202 | $filename = implode('-', $items); |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | { |
221 | 221 | $filename = null; |
222 | 222 | //@ugly fix |
223 | - foreach($this->available_extensions as $extension) { |
|
223 | + foreach ($this->available_extensions as $extension) { |
|
224 | 224 | if (is_file($this->store_path.$this->filename.'.'.$extension)) { |
225 | 225 | $filename = $this->filename.'.'.$extension; |
226 | 226 | break; |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | course_code = '".$this->course_info['code']."' |
245 | 245 | LIMIT 1"; |
246 | 246 | $result = Database::query($sql); |
247 | - $result = Database::fetch_row($result,'ASSOC'); |
|
247 | + $result = Database::fetch_row($result, 'ASSOC'); |
|
248 | 248 | |
249 | 249 | if (isset($result) && isset($result[0]) && !empty($result[0])) { |
250 | 250 | $filename = $result[0]; |
@@ -369,18 +369,18 @@ discard block |
||
369 | 369 | $html .= '<param name="ShowSpeedButton" value="false" />'; |
370 | 370 | //echo '<param name="StartTime" value="10.5" />'; |
371 | 371 | //echo '<param name="EndTime" value="65" />'; |
372 | - $html .= '<param name="AudioFormat" value="ImaADPCM" />';// ImaADPCM (more speed), Speex (more compression)|(default Speex) |
|
372 | + $html .= '<param name="AudioFormat" value="ImaADPCM" />'; // ImaADPCM (more speed), Speex (more compression)|(default Speex) |
|
373 | 373 | //$html .= '<param name="AudioFormat" value="Speex" />';// ImaADPCM (more speed), Speex (more compression)|(default Speex) |
374 | 374 | //Quality for ImaADPCM (low 8000, medium 11025, normal 22050, hight 44100) OR Quality for Speex (low 8000, medium 16000, normal 32000, hight 44100) | (default 44100) |
375 | 375 | //echo '<param name="SamplingRate" value="32000" />'; |
376 | 376 | //echo '<param name="MaxDuration" value="60" />'; |
377 | - $html .= '<param name="SoundFileURL" value="'.$url.'" />';//load a file |(default "") |
|
377 | + $html .= '<param name="SoundFileURL" value="'.$url.'" />'; //load a file |(default "") |
|
378 | 378 | $html .= '</applet>'; |
379 | 379 | $html .= '</div>'; |
380 | 380 | $html .= '</div>'; |
381 | 381 | $html .= '<div id="nanogong_warning">'.Display::return_message(get_lang('BrowserDoesNotSupportNanogongPlayer'), 'warning').$download_button.'</div>'; |
382 | 382 | |
383 | - } elseif(in_array($path_info['extension'],array('mp3', 'ogg','wav'))) { |
|
383 | + } elseif (in_array($path_info['extension'], array('mp3', 'ogg', 'wav'))) { |
|
384 | 384 | $js_path = api_get_path(WEB_LIBRARY_PATH).'javascript/'; |
385 | 385 | $html .= '<link rel="stylesheet" href="'.$js_path.'jquery-jplayer/skin/blue.monday/css/jplayer.blue.monday.css" type="text/css">'; |
386 | 386 | $html .= '<script type="text/javascript" src="'.$js_path.'jquery-jplayer/jplayer/jquery.jplayer.min.js"></script>'; |
@@ -428,7 +428,7 @@ discard block |
||
428 | 428 | |
429 | 429 | $url_delete = api_get_path(WEB_AJAX_PATH).'nanogong.ajax.php?a=delete&'.$params; |
430 | 430 | |
431 | - $js = '<script language="javascript"> |
|
431 | + $js = '<script language="javascript"> |
|
432 | 432 | |
433 | 433 | //lang vars |
434 | 434 | |
@@ -570,8 +570,8 @@ discard block |
||
570 | 570 | $html = '<center>'; |
571 | 571 | |
572 | 572 | //Use normal upload file |
573 | - $html .= Display::return_icon('microphone.png', get_lang('PressRecordButton'),'', ICON_SIZE_BIG); |
|
574 | - $html .='<br />'; |
|
573 | + $html .= Display::return_icon('microphone.png', get_lang('PressRecordButton'), '', ICON_SIZE_BIG); |
|
574 | + $html .= '<br />'; |
|
575 | 575 | |
576 | 576 | $html .= '<div id="nanogong_div">'; |
577 | 577 | |
@@ -584,7 +584,7 @@ discard block |
||
584 | 584 | $html .= '<param name="Color" value="#FFFFFF" />'; // default #FFFFFF |
585 | 585 | //echo '<param name="StartTime" value="10.5" />'; |
586 | 586 | //echo '<param name="EndTime" value="65" />'; |
587 | - $html .= '<param name="AudioFormat" value="ImaADPCM" />';// ImaADPCM (more speed), Speex (more compression)|(default Speex) |
|
587 | + $html .= '<param name="AudioFormat" value="ImaADPCM" />'; // ImaADPCM (more speed), Speex (more compression)|(default Speex) |
|
588 | 588 | //$html .= '<param name="AudioFormat" value="Speex" />';// ImaADPCM (more speed), Speex (more compression)|(default Speex) |
589 | 589 | |
590 | 590 | //echo '<param name="SamplingRate" value="32000" />';//Quality for ImaADPCM (low 8000, medium 11025, normal 22050, hight 44100) OR Quality for Speex (low 8000, medium 16000, normal 32000, hight 44100) | (default 44100) |
@@ -6,9 +6,9 @@ |
||
6 | 6 | */ |
7 | 7 | class Rights { |
8 | 8 | private static $rights_cache = array(); |
9 | - private static $rights = array ( |
|
9 | + private static $rights = array( |
|
10 | 10 | 'show_tabs:reports' => |
11 | - array ( |
|
11 | + array( |
|
12 | 12 | 'type' => 'const', |
13 | 13 | 'const' => 'true' ) |
14 | 14 | ); |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | |
158 | 158 | $new_data_order = array(); |
159 | 159 | if (!empty($docs_to_sort)) { |
160 | - foreach($docs_to_sort as $id => $document) { |
|
160 | + foreach ($docs_to_sort as $id => $document) { |
|
161 | 161 | if (isset($new_data[$id])) { |
162 | 162 | $new_data_order[] = $new_data[$id]; |
163 | 163 | } |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | } |
166 | 166 | |
167 | 167 | if (!empty($folder_to_sort)) { |
168 | - foreach($folder_to_sort as $id => $document) { |
|
168 | + foreach ($folder_to_sort as $id => $document) { |
|
169 | 169 | if (isset($new_data[$id])) { |
170 | 170 | $new_data_order[] = $new_data[$id]; |
171 | 171 | } |
@@ -425,7 +425,7 @@ discard block |
||
425 | 425 | //extra options |
426 | 426 | $plugin_settings = api_get_settings_params( |
427 | 427 | array( |
428 | - "subkey = ? AND category = ? AND type = ? " => array($plugin_name, 'Plugins','setting') |
|
428 | + "subkey = ? AND category = ? AND type = ? " => array($plugin_name, 'Plugins', 'setting') |
|
429 | 429 | ) |
430 | 430 | ); |
431 | 431 | $settings_filtered = array(); |
@@ -530,7 +530,7 @@ discard block |
||
530 | 530 | if (!empty($obj->course_settings)) { |
531 | 531 | if (is_file(api_get_path(SYS_CODE_PATH).'img/icons/'.ICON_SIZE_SMALL.'/'.$plugin_name.'.png')) { |
532 | 532 | $icon = Display::return_icon( |
533 | - $plugin_name . '.png', |
|
533 | + $plugin_name.'.png', |
|
534 | 534 | Security::remove_XSS($pluginTitle), |
535 | 535 | '', |
536 | 536 | ICON_SIZE_SMALL |
@@ -145,12 +145,12 @@ discard block |
||
145 | 145 | session_start(); |
146 | 146 | |
147 | 147 | $v = $seed = $_SESSION['seed'] = pack('H*', sha1( |
148 | - serialize($_SERVER) . |
|
149 | - serialize($_POST) . |
|
150 | - serialize($_GET) . |
|
151 | - serialize($_COOKIE) . |
|
152 | - serialize($GLOBALS) . |
|
153 | - serialize($_SESSION) . |
|
148 | + serialize($_SERVER). |
|
149 | + serialize($_POST). |
|
150 | + serialize($_GET). |
|
151 | + serialize($_COOKIE). |
|
152 | + serialize($GLOBALS). |
|
153 | + serialize($_SESSION). |
|
154 | 154 | serialize($_OLD_SESSION) |
155 | 155 | )); |
156 | 156 | if (!isset($_SESSION['count'])) { |
@@ -183,8 +183,8 @@ discard block |
||
183 | 183 | // http://tools.ietf.org/html/rfc4253#section-7.2 |
184 | 184 | // |
185 | 185 | // see the is_string($crypto) part for an example of how to expand the keys |
186 | - $key = pack('H*', sha1($seed . 'A')); |
|
187 | - $iv = pack('H*', sha1($seed . 'C')); |
|
186 | + $key = pack('H*', sha1($seed.'A')); |
|
187 | + $iv = pack('H*', sha1($seed.'C')); |
|
188 | 188 | |
189 | 189 | // ciphers are used as per the nist.gov link below. also, see this link: |
190 | 190 | // |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | $i = pack('H*', sha1(microtime())); |
232 | 232 | $r = pack('H*', sha1($i ^ $v)); |
233 | 233 | $v = pack('H*', sha1($r ^ $i)); |
234 | - $result.= $r; |
|
234 | + $result .= $r; |
|
235 | 235 | } |
236 | 236 | return substr($result, 0, $length); |
237 | 237 | } |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | $i = $crypto->encrypt(microtime()); |
244 | 244 | $r = $crypto->encrypt($i ^ $v); |
245 | 245 | $v = $crypto->encrypt($r ^ $i); |
246 | - $result.= $r; |
|
246 | + $result .= $r; |
|
247 | 247 | } |
248 | 248 | return substr($result, 0, $length); |
249 | 249 | } |
@@ -66,11 +66,11 @@ discard block |
||
66 | 66 | /** |
67 | 67 | * Toggles the mhash() implementation, which has been deprecated on PHP 5.3.0+. |
68 | 68 | */ |
69 | -define('CRYPT_HASH_MODE_MHASH', 2); |
|
69 | +define('CRYPT_HASH_MODE_MHASH', 2); |
|
70 | 70 | /** |
71 | 71 | * Toggles the hash() implementation, which works on PHP 5.1.2+. |
72 | 72 | */ |
73 | -define('CRYPT_HASH_MODE_HASH', 3); |
|
73 | +define('CRYPT_HASH_MODE_HASH', 3); |
|
74 | 74 | /**#@-*/ |
75 | 75 | |
76 | 76 | /** |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | */ |
146 | 146 | function Crypt_Hash($hash = 'sha1') |
147 | 147 | { |
148 | - if ( !defined('CRYPT_HASH_MODE') ) { |
|
148 | + if (!defined('CRYPT_HASH_MODE')) { |
|
149 | 149 | switch (true) { |
150 | 150 | case extension_loaded('hash'): |
151 | 151 | define('CRYPT_HASH_MODE', CRYPT_HASH_MODE_HASH); |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | $mode = CRYPT_HASH_MODE; |
219 | 219 | } |
220 | 220 | |
221 | - switch ( $mode ) { |
|
221 | + switch ($mode) { |
|
222 | 222 | case CRYPT_HASH_MODE_MHASH: |
223 | 223 | switch ($hash) { |
224 | 224 | case 'md5': |
@@ -296,7 +296,7 @@ discard block |
||
296 | 296 | $mode = is_array($this->hash) ? CRYPT_HASH_MODE_INTERNAL : CRYPT_HASH_MODE; |
297 | 297 | |
298 | 298 | if (!empty($this->key) || is_string($this->key)) { |
299 | - switch ( $mode ) { |
|
299 | + switch ($mode) { |
|
300 | 300 | case CRYPT_HASH_MODE_MHASH: |
301 | 301 | $output = mhash($this->hash, $text, $this->key); |
302 | 302 | break; |
@@ -310,16 +310,16 @@ discard block |
||
310 | 310 | -- http://tools.ietf.org/html/rfc2104#section-2 */ |
311 | 311 | $key = strlen($this->key) > $this->b ? call_user_func($this->hash, $this->key) : $this->key; |
312 | 312 | |
313 | - $key = str_pad($key, $this->b, chr(0)); // step 1 |
|
314 | - $temp = $this->ipad ^ $key; // step 2 |
|
315 | - $temp .= $text; // step 3 |
|
316 | - $temp = call_user_func($this->hash, $temp); // step 4 |
|
317 | - $output = $this->opad ^ $key; // step 5 |
|
318 | - $output.= $temp; // step 6 |
|
313 | + $key = str_pad($key, $this->b, chr(0)); // step 1 |
|
314 | + $temp = $this->ipad ^ $key; // step 2 |
|
315 | + $temp .= $text; // step 3 |
|
316 | + $temp = call_user_func($this->hash, $temp); // step 4 |
|
317 | + $output = $this->opad ^ $key; // step 5 |
|
318 | + $output .= $temp; // step 6 |
|
319 | 319 | $output = call_user_func($this->hash, $output); // step 7 |
320 | 320 | } |
321 | 321 | } else { |
322 | - switch ( $mode ) { |
|
322 | + switch ($mode) { |
|
323 | 323 | case CRYPT_HASH_MODE_MHASH: |
324 | 324 | $output = mhash($this->hash, $text); |
325 | 325 | break; |
@@ -378,36 +378,36 @@ 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, |
|
384 | - 138, 23, 229, 18, 190, 78, 196, 214, 218, 158, 222, 73, 160, 251, |
|
385 | - 245, 142, 187, 47, 238, 122, 169, 104, 121, 145, 21, 178, 7, 63, |
|
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, |
|
388 | - 181, 209, 215, 94, 146, 42, 172, 86, 170, 198, 79, 184, 56, 210, |
|
389 | - 150, 164, 125, 182, 118, 252, 107, 226, 156, 116, 4, 241, 69, 157, |
|
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, |
|
393 | - 234, 38, 44, 83, 13, 110, 133, 40, 132, 9, 211, 223, 205, 244, 65, |
|
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, |
|
396 | - 203, 213, 254, 59, 0, 29, 57, 242, 239, 183, 14, 102, 88, 208, 228, |
|
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 |
|
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 | + 138, 23, 229, 18, 190, 78, 196, 214, 218, 158, 222, 73, 160, 251, |
|
385 | + 245, 142, 187, 47, 238, 122, 169, 104, 121, 145, 21, 178, 7, 63, |
|
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, |
|
388 | + 181, 209, 215, 94, 146, 42, 172, 86, 170, 198, 79, 184, 56, 210, |
|
389 | + 150, 164, 125, 182, 118, 252, 107, 226, 156, 116, 4, 241, 69, 157, |
|
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, |
|
393 | + 234, 38, 44, 83, 13, 110, 133, 40, 132, 9, 211, 223, 205, 244, 65, |
|
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, |
|
396 | + 203, 213, 254, 59, 0, 29, 57, 242, 239, 183, 14, 102, 88, 208, 228, |
|
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 |
|
399 | 399 | ); |
400 | 400 | |
401 | 401 | // Step 1. Append Padding Bytes |
402 | 402 | $pad = 16 - (strlen($m) & 0xF); |
403 | - $m.= str_repeat(chr($pad), $pad); |
|
403 | + $m .= str_repeat(chr($pad), $pad); |
|
404 | 404 | |
405 | 405 | $length = strlen($m); |
406 | 406 | |
407 | 407 | // Step 2. Append Checksum |
408 | 408 | $c = str_repeat(chr(0), 16); |
409 | 409 | $l = chr(0); |
410 | - for ($i = 0; $i < $length; $i+= 16) { |
|
410 | + for ($i = 0; $i < $length; $i += 16) { |
|
411 | 411 | for ($j = 0; $j < 16; $j++) { |
412 | 412 | // RFC1319 incorrectly states that C[j] should be set to S[c xor L] |
413 | 413 | //$c[$j] = chr($s[ord($m[$i + $j] ^ $l)]); |
@@ -416,15 +416,15 @@ discard block |
||
416 | 416 | $l = $c[$j]; |
417 | 417 | } |
418 | 418 | } |
419 | - $m.= $c; |
|
419 | + $m .= $c; |
|
420 | 420 | |
421 | - $length+= 16; |
|
421 | + $length += 16; |
|
422 | 422 | |
423 | 423 | // Step 3. Initialize MD Buffer |
424 | 424 | $x = str_repeat(chr(0), 48); |
425 | 425 | |
426 | 426 | // Step 4. Process Message in 16-Byte Blocks |
427 | - for ($i = 0; $i < $length; $i+= 16) { |
|
427 | + for ($i = 0; $i < $length; $i += 16) { |
|
428 | 428 | for ($j = 0; $j < 16; $j++) { |
429 | 429 | $x[$j + 16] = $m[$i + $j]; |
430 | 430 | $x[$j + 32] = $x[$j + 16] ^ $x[$j]; |
@@ -477,10 +477,10 @@ discard block |
||
477 | 477 | // Pre-processing |
478 | 478 | $length = strlen($m); |
479 | 479 | // to round to nearest 56 mod 64, we'll add 64 - (length + (64 - 56)) % 64 |
480 | - $m.= str_repeat(chr(0), 64 - (($length + 8) & 0x3F)); |
|
480 | + $m .= str_repeat(chr(0), 64 - (($length + 8) & 0x3F)); |
|
481 | 481 | $m[$length] = chr(0x80); |
482 | 482 | // we don't support hashing strings 512MB long |
483 | - $m.= pack('N2', 0, $length << 3); |
|
483 | + $m .= pack('N2', 0, $length << 3); |
|
484 | 484 | |
485 | 485 | // Process the message in successive 512-bit chunks |
486 | 486 | $chunks = str_split($m, 64); |
@@ -493,12 +493,12 @@ discard block |
||
493 | 493 | |
494 | 494 | // Extend the sixteen 32-bit words into sixty-four 32-bit words |
495 | 495 | for ($i = 16; $i < 64; $i++) { |
496 | - $s0 = $this->_rightRotate($w[$i - 15], 7) ^ |
|
496 | + $s0 = $this->_rightRotate($w[$i - 15], 7) ^ |
|
497 | 497 | $this->_rightRotate($w[$i - 15], 18) ^ |
498 | - $this->_rightShift( $w[$i - 15], 3); |
|
498 | + $this->_rightShift($w[$i - 15], 3); |
|
499 | 499 | $s1 = $this->_rightRotate($w[$i - 2], 17) ^ |
500 | 500 | $this->_rightRotate($w[$i - 2], 19) ^ |
501 | - $this->_rightShift( $w[$i - 2], 10); |
|
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 | } |
@@ -508,7 +508,7 @@ discard block |
||
508 | 508 | |
509 | 509 | // Main loop |
510 | 510 | for ($i = 0; $i < 64; $i++) { |
511 | - $s0 = $this->_rightRotate($a, 2) ^ |
|
511 | + $s0 = $this->_rightRotate($a, 2) ^ |
|
512 | 512 | $this->_rightRotate($a, 13) ^ |
513 | 513 | $this->_rightRotate($a, 22); |
514 | 514 | $maj = ($a & $b) ^ |
@@ -516,7 +516,7 @@ discard block |
||
516 | 516 | ($b & $c); |
517 | 517 | $t2 = $this->_add($s0, $maj); |
518 | 518 | |
519 | - $s1 = $this->_rightRotate($e, 6) ^ |
|
519 | + $s1 = $this->_rightRotate($e, 6) ^ |
|
520 | 520 | $this->_rightRotate($e, 11) ^ |
521 | 521 | $this->_rightRotate($e, 25); |
522 | 522 | $ch = ($e & $f) ^ |
@@ -617,10 +617,10 @@ discard block |
||
617 | 617 | // Pre-processing |
618 | 618 | $length = strlen($m); |
619 | 619 | // to round to nearest 112 mod 128, we'll add 128 - (length + (128 - 112)) % 128 |
620 | - $m.= str_repeat(chr(0), 128 - (($length + 16) & 0x7F)); |
|
620 | + $m .= str_repeat(chr(0), 128 - (($length + 16) & 0x7F)); |
|
621 | 621 | $m[$length] = chr(0x80); |
622 | 622 | // we don't support hashing strings 512MB long |
623 | - $m.= pack('N4', 0, 0, 0, $length << 3); |
|
623 | + $m .= pack('N4', 0, 0, 0, $length << 3); |
|
624 | 624 | |
625 | 625 | // Process the message in successive 1024-bit chunks |
626 | 626 | $chunks = str_split($m, 128); |
@@ -724,10 +724,10 @@ discard block |
||
724 | 724 | |
725 | 725 | // Produce the final hash value (big-endian) |
726 | 726 | // (Crypt_Hash::hash() trims the output for hashes but not for HMACs. as such, we trim the output here) |
727 | - $temp = $hash[0]->toBytes() . $hash[1]->toBytes() . $hash[2]->toBytes() . $hash[3]->toBytes() . |
|
728 | - $hash[4]->toBytes() . $hash[5]->toBytes(); |
|
727 | + $temp = $hash[0]->toBytes().$hash[1]->toBytes().$hash[2]->toBytes().$hash[3]->toBytes(). |
|
728 | + $hash[4]->toBytes().$hash[5]->toBytes(); |
|
729 | 729 | if ($this->l != 48) { |
730 | - $temp.= $hash[6]->toBytes() . $hash[7]->toBytes(); |
|
730 | + $temp .= $hash[6]->toBytes().$hash[7]->toBytes(); |
|
731 | 731 | } |
732 | 732 | |
733 | 733 | return $temp; |
@@ -798,7 +798,7 @@ discard block |
||
798 | 798 | $result = 0; |
799 | 799 | $arguments = func_get_args(); |
800 | 800 | foreach ($arguments as $argument) { |
801 | - $result+= $argument < 0 ? ($argument & 0x7FFFFFFF) + 0x80000000 : $argument; |
|
801 | + $result += $argument < 0 ? ($argument & 0x7FFFFFFF) + 0x80000000 : $argument; |
|
802 | 802 | } |
803 | 803 | |
804 | 804 | return fmod($result, $mod); |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | */ |
178 | 178 | function Crypt_AES($mode = CRYPT_AES_MODE_CBC) |
179 | 179 | { |
180 | - if ( !defined('CRYPT_AES_MODE') ) { |
|
180 | + if (!defined('CRYPT_AES_MODE')) { |
|
181 | 181 | switch (true) { |
182 | 182 | case extension_loaded('mcrypt') && in_array('rijndael-128', mcrypt_list_algorithms()): |
183 | 183 | define('CRYPT_AES_MODE', CRYPT_AES_MODE_MCRYPT); |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | } |
188 | 188 | } |
189 | 189 | |
190 | - switch ( CRYPT_AES_MODE ) { |
|
190 | + switch (CRYPT_AES_MODE) { |
|
191 | 191 | case CRYPT_AES_MODE_MCRYPT: |
192 | 192 | switch ($mode) { |
193 | 193 | case CRYPT_AES_MODE_ECB: |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | function setIV($iv) |
268 | 268 | { |
269 | 269 | parent::setIV($iv); |
270 | - if ( CRYPT_AES_MODE == CRYPT_AES_MODE_MCRYPT ) { |
|
270 | + if (CRYPT_AES_MODE == CRYPT_AES_MODE_MCRYPT) { |
|
271 | 271 | $this->changed = true; |
272 | 272 | } |
273 | 273 | } |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | */ |
292 | 292 | function encrypt($plaintext) |
293 | 293 | { |
294 | - if ( CRYPT_AES_MODE == CRYPT_AES_MODE_MCRYPT ) { |
|
294 | + if (CRYPT_AES_MODE == CRYPT_AES_MODE_MCRYPT) { |
|
295 | 295 | $this->_mcryptSetup(); |
296 | 296 | |
297 | 297 | // re: http://phpseclib.sourceforge.net/cfb-demo.phps |
@@ -308,11 +308,11 @@ discard block |
||
308 | 308 | $max = 16 - $pos; |
309 | 309 | if ($len >= $max) { |
310 | 310 | $i = $max; |
311 | - $len-= $max; |
|
311 | + $len -= $max; |
|
312 | 312 | $pos = 0; |
313 | 313 | } else { |
314 | 314 | $i = $len; |
315 | - $pos+= $len; |
|
315 | + $pos += $len; |
|
316 | 316 | $len = 0; |
317 | 317 | } |
318 | 318 | $ciphertext = substr($iv, $orig_pos) ^ $plaintext; |
@@ -325,15 +325,15 @@ discard block |
||
325 | 325 | mcrypt_generic_init($this->enmcrypt, $this->key, $iv); |
326 | 326 | $this->enbuffer['enmcrypt_init'] = false; |
327 | 327 | } |
328 | - $ciphertext.= mcrypt_generic($this->enmcrypt, substr($plaintext, $i, $len - $len % 16)); |
|
328 | + $ciphertext .= mcrypt_generic($this->enmcrypt, substr($plaintext, $i, $len - $len % 16)); |
|
329 | 329 | $iv = substr($ciphertext, -16); |
330 | - $len%= 16; |
|
330 | + $len %= 16; |
|
331 | 331 | } else { |
332 | 332 | while ($len >= 16) { |
333 | 333 | $iv = mcrypt_generic($this->ecb, $iv) ^ substr($plaintext, $i, 16); |
334 | - $ciphertext.= $iv; |
|
335 | - $len-= 16; |
|
336 | - $i+= 16; |
|
334 | + $ciphertext .= $iv; |
|
335 | + $len -= 16; |
|
336 | + $i += 16; |
|
337 | 337 | } |
338 | 338 | } |
339 | 339 | } |
@@ -342,7 +342,7 @@ discard block |
||
342 | 342 | $iv = mcrypt_generic($this->ecb, $iv); |
343 | 343 | $block = $iv ^ substr($plaintext, -$len); |
344 | 344 | $iv = substr_replace($iv, $block, 0, $len); |
345 | - $ciphertext.= $block; |
|
345 | + $ciphertext .= $block; |
|
346 | 346 | $pos = $len; |
347 | 347 | } |
348 | 348 | |
@@ -376,7 +376,7 @@ discard block |
||
376 | 376 | */ |
377 | 377 | function decrypt($ciphertext) |
378 | 378 | { |
379 | - if ( CRYPT_AES_MODE == CRYPT_AES_MODE_MCRYPT ) { |
|
379 | + if (CRYPT_AES_MODE == CRYPT_AES_MODE_MCRYPT) { |
|
380 | 380 | $this->_mcryptSetup(); |
381 | 381 | |
382 | 382 | if ($this->mode == 'ncfb' && $this->continuousBuffer) { |
@@ -390,11 +390,11 @@ discard block |
||
390 | 390 | $max = 16 - $pos; |
391 | 391 | if ($len >= $max) { |
392 | 392 | $i = $max; |
393 | - $len-= $max; |
|
393 | + $len -= $max; |
|
394 | 394 | $pos = 0; |
395 | 395 | } else { |
396 | 396 | $i = $len; |
397 | - $pos+= $len; |
|
397 | + $pos += $len; |
|
398 | 398 | $len = 0; |
399 | 399 | } |
400 | 400 | // ie. $i = min($max, $len), $len-= $i, $pos+= $i, $pos%= $blocksize |
@@ -403,13 +403,13 @@ discard block |
||
403 | 403 | } |
404 | 404 | if ($len >= 16) { |
405 | 405 | $cb = substr($ciphertext, $i, $len - $len % 16); |
406 | - $plaintext.= mcrypt_generic($this->ecb, $iv . $cb) ^ $cb; |
|
406 | + $plaintext .= mcrypt_generic($this->ecb, $iv.$cb) ^ $cb; |
|
407 | 407 | $iv = substr($cb, -16); |
408 | - $len%= 16; |
|
408 | + $len %= 16; |
|
409 | 409 | } |
410 | 410 | if ($len) { |
411 | 411 | $iv = mcrypt_generic($this->ecb, $iv); |
412 | - $plaintext.= $iv ^ substr($ciphertext, -$len); |
|
412 | + $plaintext .= $iv ^ substr($ciphertext, -$len); |
|
413 | 413 | $iv = substr_replace($iv, substr($ciphertext, -$len), 0, $len); |
414 | 414 | $pos = $len; |
415 | 415 | } |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | * @access private |
279 | 279 | * @var array |
280 | 280 | */ |
281 | - var $sbox0 = array ( |
|
281 | + var $sbox0 = array( |
|
282 | 282 | 0xd1310ba6, 0x98dfb5ac, 0x2ffd72db, 0xd01adfb7, 0xb8e1afed, 0x6a267e96, 0xba7c9045, 0xf12c7f99, |
283 | 283 | 0x24a19947, 0xb3916cf7, 0x0801f2e2, 0x858efc16, 0x636920d8, 0x71574e69, 0xa458fea3, 0xf4933d7e, |
284 | 284 | 0x0d95748f, 0x728eb658, 0x718bcd58, 0x82154aee, 0x7b54a41d, 0xc25a59b5, 0x9c30d539, 0x2af26013, |
@@ -469,7 +469,7 @@ discard block |
||
469 | 469 | */ |
470 | 470 | function Crypt_Blowfish($mode = CRYPT_BLOWFISH_MODE_CBC) |
471 | 471 | { |
472 | - if ( !defined('CRYPT_BLOWFISH_MODE') ) { |
|
472 | + if (!defined('CRYPT_BLOWFISH_MODE')) { |
|
473 | 473 | switch (true) { |
474 | 474 | case extension_loaded('mcrypt') && in_array('blowfish', mcrypt_list_algorithms()): |
475 | 475 | define('CRYPT_BLOWFISH_MODE', CRYPT_BLOWFISH_MODE_MCRYPT); |
@@ -479,7 +479,7 @@ discard block |
||
479 | 479 | } |
480 | 480 | } |
481 | 481 | |
482 | - switch ( CRYPT_BLOWFISH_MODE ) { |
|
482 | + switch (CRYPT_BLOWFISH_MODE) { |
|
483 | 483 | case CRYPT_BLOWFISH_MODE_MCRYPT: |
484 | 484 | switch ($mode) { |
485 | 485 | case CRYPT_BLOWFISH_MODE_ECB: |
@@ -590,13 +590,13 @@ discard block |
||
590 | 590 | $datar = 0; |
591 | 591 | for ($i = 0; $i < 18; $i += 2) { |
592 | 592 | $this->_encryptBlock($datal, $datar); |
593 | - $this->bctx['p'][$i ] = $datal; |
|
593 | + $this->bctx['p'][$i] = $datal; |
|
594 | 594 | $this->bctx['p'][$i + 1] = $datar; |
595 | 595 | } |
596 | 596 | for ($i = 0; $i < 4; ++$i) { |
597 | 597 | for ($j = 0; $j < 256; $j += 2) { |
598 | 598 | $this->_encryptBlock($datal, $datar); |
599 | - $this->bctx['sb'][$i][$j ] = $datal; |
|
599 | + $this->bctx['sb'][$i][$j] = $datal; |
|
600 | 600 | $this->bctx['sb'][$i][$j + 1] = $datar; |
601 | 601 | } |
602 | 602 | } |
@@ -622,17 +622,17 @@ discard block |
||
622 | 622 | |
623 | 623 | $i = -1; |
624 | 624 | while ($i < 15) { |
625 | - $l^= $p[++$i]; |
|
626 | - $r^= ($sb_0[$l >> 24 & 0xff] + |
|
627 | - $sb_1[$l >> 16 & 0xff] ^ |
|
628 | - $sb_2[$l >> 8 & 0xff]) + |
|
629 | - $sb_3[$l & 0xff]; |
|
630 | - |
|
631 | - $r^= $p[++$i]; |
|
632 | - $l^= ($sb_0[$r >> 24 & 0xff] + |
|
633 | - $sb_1[$r >> 16 & 0xff] ^ |
|
634 | - $sb_2[$r >> 8 & 0xff]) + |
|
635 | - $sb_3[$r & 0xff]; |
|
625 | + $l ^= $p[++$i]; |
|
626 | + $r ^= ($sb_0[$l >> 24 & 0xff] + |
|
627 | + $sb_1[$l >> 16 & 0xff] ^ |
|
628 | + $sb_2[$l >> 8 & 0xff]) + |
|
629 | + $sb_3[$l & 0xff]; |
|
630 | + |
|
631 | + $r ^= $p[++$i]; |
|
632 | + $l ^= ($sb_0[$r >> 24 & 0xff] + |
|
633 | + $sb_1[$r >> 16 & 0xff] ^ |
|
634 | + $sb_2[$r >> 8 & 0xff]) + |
|
635 | + $sb_3[$r & 0xff]; |
|
636 | 636 | |
637 | 637 | } |
638 | 638 | $Xr = $l ^ $p[16]; |
@@ -656,7 +656,7 @@ discard block |
||
656 | 656 | |
657 | 657 | switch ($method) { |
658 | 658 | default: // 'pbkdf2' |
659 | - list(, , $hash, $salt, $count) = func_get_args(); |
|
659 | + list(,, $hash, $salt, $count) = func_get_args(); |
|
660 | 660 | if (!isset($hash)) { |
661 | 661 | $hash = 'sha1'; |
662 | 662 | } |
@@ -680,12 +680,12 @@ discard block |
||
680 | 680 | $hmac = new Crypt_Hash(); |
681 | 681 | $hmac->setHash($hash); |
682 | 682 | $hmac->setKey($password); |
683 | - $f = $u = $hmac->hash($salt . pack('N', $i++)); |
|
683 | + $f = $u = $hmac->hash($salt.pack('N', $i++)); |
|
684 | 684 | for ($j = 2; $j <= $count; $j++) { |
685 | 685 | $u = $hmac->hash($u); |
686 | - $f^= $u; |
|
686 | + $f ^= $u; |
|
687 | 687 | } |
688 | - $key.= $f; |
|
688 | + $key .= $f; |
|
689 | 689 | } |
690 | 690 | } |
691 | 691 | |
@@ -727,7 +727,7 @@ discard block |
||
727 | 727 | */ |
728 | 728 | function encrypt($plaintext) |
729 | 729 | { |
730 | - if ( CRYPT_BLOWFISH_MODE == CRYPT_BLOWFISH_MODE_MCRYPT ) { |
|
730 | + if (CRYPT_BLOWFISH_MODE == CRYPT_BLOWFISH_MODE_MCRYPT) { |
|
731 | 731 | if ($this->paddable) { |
732 | 732 | $plaintext = $this->_pad($plaintext); |
733 | 733 | } |
@@ -753,11 +753,11 @@ discard block |
||
753 | 753 | $max = 8 - $pos; |
754 | 754 | if ($len >= $max) { |
755 | 755 | $i = $max; |
756 | - $len-= $max; |
|
756 | + $len -= $max; |
|
757 | 757 | $pos = 0; |
758 | 758 | } else { |
759 | 759 | $i = $len; |
760 | - $pos+= $len; |
|
760 | + $pos += $len; |
|
761 | 761 | $len = 0; |
762 | 762 | } |
763 | 763 | $ciphertext = substr($iv, $orig_pos) ^ $plaintext; |
@@ -770,15 +770,15 @@ discard block |
||
770 | 770 | mcrypt_generic_init($this->enmcrypt, $this->key, $iv); |
771 | 771 | $this->enbuffer['enmcrypt_init'] = false; |
772 | 772 | } |
773 | - $ciphertext.= mcrypt_generic($this->enmcrypt, substr($plaintext, $i, $len - $len % 8)); |
|
773 | + $ciphertext .= mcrypt_generic($this->enmcrypt, substr($plaintext, $i, $len - $len % 8)); |
|
774 | 774 | $iv = substr($ciphertext, -8); |
775 | - $len%= 8; |
|
775 | + $len %= 8; |
|
776 | 776 | } else { |
777 | 777 | while ($len >= 8) { |
778 | 778 | $iv = mcrypt_generic($this->ecb, $iv) ^ substr($plaintext, $i, 8); |
779 | - $ciphertext.= $iv; |
|
780 | - $len-= 8; |
|
781 | - $i+= 8; |
|
779 | + $ciphertext .= $iv; |
|
780 | + $len -= 8; |
|
781 | + $i += 8; |
|
782 | 782 | } |
783 | 783 | } |
784 | 784 | } |
@@ -786,7 +786,7 @@ discard block |
||
786 | 786 | $iv = mcrypt_generic($this->ecb, $iv); |
787 | 787 | $block = $iv ^ substr($plaintext, -$len); |
788 | 788 | $iv = substr_replace($iv, $block, 0, $len); |
789 | - $ciphertext.= $block; |
|
789 | + $ciphertext .= $block; |
|
790 | 790 | $pos = $len; |
791 | 791 | } |
792 | 792 | return $ciphertext; |
@@ -818,7 +818,7 @@ discard block |
||
818 | 818 | */ |
819 | 819 | function decrypt($ciphertext) |
820 | 820 | { |
821 | - if ( CRYPT_BLOWFISH_MODE == CRYPT_BLOWFISH_MODE_MCRYPT ) { |
|
821 | + if (CRYPT_BLOWFISH_MODE == CRYPT_BLOWFISH_MODE_MCRYPT) { |
|
822 | 822 | if ($this->paddable) { |
823 | 823 | // we pad with chr(0) since that's what mcrypt_generic does. to quote from http://php.net/function.mcrypt-generic : |
824 | 824 | // "The data is padded with "\0" to make sure the length of the data is n * blocksize." |
@@ -846,11 +846,11 @@ discard block |
||
846 | 846 | $max = 8 - $pos; |
847 | 847 | if ($len >= $max) { |
848 | 848 | $i = $max; |
849 | - $len-= $max; |
|
849 | + $len -= $max; |
|
850 | 850 | $pos = 0; |
851 | 851 | } else { |
852 | 852 | $i = $len; |
853 | - $pos+= $len; |
|
853 | + $pos += $len; |
|
854 | 854 | $len = 0; |
855 | 855 | } |
856 | 856 | $plaintext = substr($iv, $orig_pos) ^ $ciphertext; |
@@ -858,13 +858,13 @@ discard block |
||
858 | 858 | } |
859 | 859 | if ($len >= 8) { |
860 | 860 | $cb = substr($ciphertext, $i, $len - $len % 8); |
861 | - $plaintext.= mcrypt_generic($this->ecb, $iv . $cb) ^ $cb; |
|
861 | + $plaintext .= mcrypt_generic($this->ecb, $iv.$cb) ^ $cb; |
|
862 | 862 | $iv = substr($cb, -8); |
863 | - $len%= 8; |
|
863 | + $len %= 8; |
|
864 | 864 | } |
865 | 865 | if ($len) { |
866 | 866 | $iv = mcrypt_generic($this->ecb, $iv); |
867 | - $plaintext.= $iv ^ substr($ciphertext, -$len); |
|
867 | + $plaintext .= $iv ^ substr($ciphertext, -$len); |
|
868 | 868 | $iv = substr_replace($iv, substr($ciphertext, -$len), 0, $len); |
869 | 869 | $pos = $len; |
870 | 870 | } |
@@ -1032,7 +1032,7 @@ discard block |
||
1032 | 1032 | function _generate_xor(&$iv) |
1033 | 1033 | { |
1034 | 1034 | $xor = $iv; |
1035 | - for ($j = 4; $j <= 8; $j+=4) { |
|
1035 | + for ($j = 4; $j <= 8; $j += 4) { |
|
1036 | 1036 | $temp = substr($iv, -$j, 4); |
1037 | 1037 | switch ($temp) { |
1038 | 1038 | case "\xFF\xFF\xFF\xFF": |
@@ -1058,7 +1058,7 @@ discard block |
||
1058 | 1058 | */ |
1059 | 1059 | function inline_crypt_setup() |
1060 | 1060 | {/*{{{*/ |
1061 | - $lambda_functions =& Crypt_Blowfish::get_lambda_functions(); |
|
1061 | + $lambda_functions = & Crypt_Blowfish::get_lambda_functions(); |
|
1062 | 1062 | $block_size = 8; |
1063 | 1063 | $mode = $this->mode; |
1064 | 1064 | $code_hash = "$mode"; |
@@ -1075,8 +1075,8 @@ discard block |
||
1075 | 1075 | $l = $in[1]; |
1076 | 1076 | $r = $in[2]; |
1077 | 1077 | '; |
1078 | - for ($i = 0; $i < 16; $i+= 2) { |
|
1079 | - $_encryptBlock.= ' |
|
1078 | + for ($i = 0; $i < 16; $i += 2) { |
|
1079 | + $_encryptBlock .= ' |
|
1080 | 1080 | $l^= $p_'.($i).'; |
1081 | 1081 | $r^= ($sb_0[$l >> 24 & 0xff] + |
1082 | 1082 | $sb_1[$l >> 16 & 0xff] ^ |
@@ -1090,7 +1090,7 @@ discard block |
||
1090 | 1090 | $sb_3[$r & 0xff]; |
1091 | 1091 | '; |
1092 | 1092 | } |
1093 | - $_encryptBlock.= ' |
|
1093 | + $_encryptBlock .= ' |
|
1094 | 1094 | $in = pack("N*", $r ^ $p_17, $l ^ $p_16); |
1095 | 1095 | '; |
1096 | 1096 | |
@@ -1101,8 +1101,8 @@ discard block |
||
1101 | 1101 | $r = $in[2]; |
1102 | 1102 | '; |
1103 | 1103 | |
1104 | - for ($i = 17; $i > 2; $i-= 2) { |
|
1105 | - $_decryptBlock.= ' |
|
1104 | + for ($i = 17; $i > 2; $i -= 2) { |
|
1105 | + $_decryptBlock .= ' |
|
1106 | 1106 | $l^= $p_'.($i).'; |
1107 | 1107 | $r^= ($sb_0[$l >> 24 & 0xff] + |
1108 | 1108 | $sb_1[$l >> 16 & 0xff] ^ |
@@ -1117,7 +1117,7 @@ discard block |
||
1117 | 1117 | '; |
1118 | 1118 | } |
1119 | 1119 | |
1120 | - $_decryptBlock.= ' |
|
1120 | + $_decryptBlock .= ' |
|
1121 | 1121 | $in = pack("N*", $r ^ $p_0, $l ^ $p_1); |
1122 | 1122 | '; |
1123 | 1123 | |
@@ -1439,12 +1439,12 @@ discard block |
||
1439 | 1439 | break; |
1440 | 1440 | } |
1441 | 1441 | $fnc_head = '$action, &$self, $text'; |
1442 | - $fnc_body = $init_cryptBlock . 'if ($action == "encrypt") { ' . $encrypt . ' } else { ' . $decrypt . ' }'; |
|
1442 | + $fnc_body = $init_cryptBlock.'if ($action == "encrypt") { '.$encrypt.' } else { '.$decrypt.' }'; |
|
1443 | 1443 | |
1444 | 1444 | if (function_exists('create_function') && is_callable('create_function')) { |
1445 | 1445 | $lambda_functions[$code_hash] = create_function($fnc_head, $fnc_body); |
1446 | 1446 | } else { |
1447 | - eval('function ' . ($lambda_functions[$code_hash] = 'f' . md5(microtime())) . '(' . $fnc_head . ') { ' . $fnc_body . ' }'); |
|
1447 | + eval('function '.($lambda_functions[$code_hash] = 'f'.md5(microtime())).'('.$fnc_head.') { '.$fnc_body.' }'); |
|
1448 | 1448 | } |
1449 | 1449 | } |
1450 | 1450 | $this->inline_crypt = $lambda_functions[$code_hash]; |
@@ -747,7 +747,7 @@ discard block |
||
747 | 747 | */ |
748 | 748 | function Crypt_DES($mode = CRYPT_DES_MODE_CBC) |
749 | 749 | { |
750 | - if ( !defined('CRYPT_DES_MODE') ) { |
|
750 | + if (!defined('CRYPT_DES_MODE')) { |
|
751 | 751 | switch (true) { |
752 | 752 | case extension_loaded('mcrypt') && in_array('des', mcrypt_list_algorithms()): |
753 | 753 | define('CRYPT_DES_MODE', CRYPT_DES_MODE_MCRYPT); |
@@ -757,7 +757,7 @@ discard block |
||
757 | 757 | } |
758 | 758 | } |
759 | 759 | |
760 | - switch ( CRYPT_DES_MODE ) { |
|
760 | + switch (CRYPT_DES_MODE) { |
|
761 | 761 | case CRYPT_DES_MODE_MCRYPT: |
762 | 762 | switch ($mode) { |
763 | 763 | case CRYPT_DES_MODE_ECB: |
@@ -823,7 +823,7 @@ discard block |
||
823 | 823 | */ |
824 | 824 | function setKey($key) |
825 | 825 | { |
826 | - $this->keys = ( CRYPT_DES_MODE == CRYPT_DES_MODE_MCRYPT ) ? str_pad(substr($key, 0, 8), 8, chr(0)) : $this->_prepareKey($key); |
|
826 | + $this->keys = (CRYPT_DES_MODE == CRYPT_DES_MODE_MCRYPT) ? str_pad(substr($key, 0, 8), 8, chr(0)) : $this->_prepareKey($key); |
|
827 | 827 | $this->enchanged = true; |
828 | 828 | $this->dechanged = true; |
829 | 829 | } |
@@ -845,7 +845,7 @@ discard block |
||
845 | 845 | |
846 | 846 | switch ($method) { |
847 | 847 | default: // 'pbkdf2' |
848 | - list(, , $hash, $salt, $count) = func_get_args(); |
|
848 | + list(,, $hash, $salt, $count) = func_get_args(); |
|
849 | 849 | if (!isset($hash)) { |
850 | 850 | $hash = 'sha1'; |
851 | 851 | } |
@@ -869,12 +869,12 @@ discard block |
||
869 | 869 | $hmac = new Crypt_Hash(); |
870 | 870 | $hmac->setHash($hash); |
871 | 871 | $hmac->setKey($password); |
872 | - $f = $u = $hmac->hash($salt . pack('N', $i++)); |
|
872 | + $f = $u = $hmac->hash($salt.pack('N', $i++)); |
|
873 | 873 | for ($j = 2; $j <= $count; $j++) { |
874 | 874 | $u = $hmac->hash($u); |
875 | - $f^= $u; |
|
875 | + $f ^= $u; |
|
876 | 876 | } |
877 | - $key.= $f; |
|
877 | + $key .= $f; |
|
878 | 878 | } |
879 | 879 | } |
880 | 880 | |
@@ -911,7 +911,7 @@ discard block |
||
911 | 911 | function _generate_xor(&$iv) |
912 | 912 | { |
913 | 913 | $xor = $iv; |
914 | - for ($j = 4; $j <= 8; $j+=4) { |
|
914 | + for ($j = 4; $j <= 8; $j += 4) { |
|
915 | 915 | $temp = substr($iv, -$j, 4); |
916 | 916 | switch ($temp) { |
917 | 917 | case "\xFF\xFF\xFF\xFF": |
@@ -953,7 +953,7 @@ discard block |
||
953 | 953 | $plaintext = $this->_pad($plaintext); |
954 | 954 | } |
955 | 955 | |
956 | - if ( CRYPT_DES_MODE == CRYPT_DES_MODE_MCRYPT ) { |
|
956 | + if (CRYPT_DES_MODE == CRYPT_DES_MODE_MCRYPT) { |
|
957 | 957 | if ($this->enchanged) { |
958 | 958 | mcrypt_generic_init($this->enmcrypt, $this->keys, $this->encryptIV); |
959 | 959 | if ($this->mode == 'ncfb') { |
@@ -975,11 +975,11 @@ discard block |
||
975 | 975 | $max = 8 - $pos; |
976 | 976 | if ($len >= $max) { |
977 | 977 | $i = $max; |
978 | - $len-= $max; |
|
978 | + $len -= $max; |
|
979 | 979 | $pos = 0; |
980 | 980 | } else { |
981 | 981 | $i = $len; |
982 | - $pos+= $len; |
|
982 | + $pos += $len; |
|
983 | 983 | $len = 0; |
984 | 984 | } |
985 | 985 | $ciphertext = substr($iv, $orig_pos) ^ $plaintext; |
@@ -992,15 +992,15 @@ discard block |
||
992 | 992 | mcrypt_generic_init($this->enmcrypt, $this->keys, $iv); |
993 | 993 | $this->enbuffer['enmcrypt_init'] = false; |
994 | 994 | } |
995 | - $ciphertext.= mcrypt_generic($this->enmcrypt, substr($plaintext, $i, $len - $len % 8)); |
|
995 | + $ciphertext .= mcrypt_generic($this->enmcrypt, substr($plaintext, $i, $len - $len % 8)); |
|
996 | 996 | $iv = substr($ciphertext, -8); |
997 | - $len%= 8; |
|
997 | + $len %= 8; |
|
998 | 998 | } else { |
999 | 999 | while ($len >= 8) { |
1000 | 1000 | $iv = mcrypt_generic($this->ecb, $iv) ^ substr($plaintext, $i, 8); |
1001 | - $ciphertext.= $iv; |
|
1002 | - $len-= 8; |
|
1003 | - $i+= 8; |
|
1001 | + $ciphertext .= $iv; |
|
1002 | + $len -= 8; |
|
1003 | + $i += 8; |
|
1004 | 1004 | } |
1005 | 1005 | } |
1006 | 1006 | } |
@@ -1008,7 +1008,7 @@ discard block |
||
1008 | 1008 | $iv = mcrypt_generic($this->ecb, $iv); |
1009 | 1009 | $block = $iv ^ substr($plaintext, -$len); |
1010 | 1010 | $iv = substr_replace($iv, $block, 0, $len); |
1011 | - $ciphertext.= $block; |
|
1011 | + $ciphertext .= $block; |
|
1012 | 1012 | $pos = $len; |
1013 | 1013 | } |
1014 | 1014 | return $ciphertext; |
@@ -1035,17 +1035,17 @@ discard block |
||
1035 | 1035 | $ciphertext = ''; |
1036 | 1036 | switch ($this->mode) { |
1037 | 1037 | case CRYPT_DES_MODE_ECB: |
1038 | - for ($i = 0; $i < strlen($plaintext); $i+=8) { |
|
1039 | - $ciphertext.= $this->_processBlock(substr($plaintext, $i, 8), CRYPT_DES_ENCRYPT); |
|
1038 | + for ($i = 0; $i < strlen($plaintext); $i += 8) { |
|
1039 | + $ciphertext .= $this->_processBlock(substr($plaintext, $i, 8), CRYPT_DES_ENCRYPT); |
|
1040 | 1040 | } |
1041 | 1041 | break; |
1042 | 1042 | case CRYPT_DES_MODE_CBC: |
1043 | 1043 | $xor = $this->encryptIV; |
1044 | - for ($i = 0; $i < strlen($plaintext); $i+=8) { |
|
1044 | + for ($i = 0; $i < strlen($plaintext); $i += 8) { |
|
1045 | 1045 | $block = substr($plaintext, $i, 8); |
1046 | 1046 | $block = $this->_processBlock($block ^ $xor, CRYPT_DES_ENCRYPT); |
1047 | 1047 | $xor = $block; |
1048 | - $ciphertext.= $block; |
|
1048 | + $ciphertext .= $block; |
|
1049 | 1049 | } |
1050 | 1050 | if ($this->continuousBuffer) { |
1051 | 1051 | $this->encryptIV = $xor; |
@@ -1054,25 +1054,25 @@ discard block |
||
1054 | 1054 | case CRYPT_DES_MODE_CTR: |
1055 | 1055 | $xor = $this->encryptIV; |
1056 | 1056 | if (strlen($buffer['encrypted'])) { |
1057 | - for ($i = 0; $i < strlen($plaintext); $i+=8) { |
|
1057 | + for ($i = 0; $i < strlen($plaintext); $i += 8) { |
|
1058 | 1058 | $block = substr($plaintext, $i, 8); |
1059 | 1059 | if (strlen($block) > strlen($buffer['encrypted'])) { |
1060 | - $buffer['encrypted'].= $this->_processBlock($this->_generate_xor($xor), CRYPT_DES_ENCRYPT); |
|
1060 | + $buffer['encrypted'] .= $this->_processBlock($this->_generate_xor($xor), CRYPT_DES_ENCRYPT); |
|
1061 | 1061 | } |
1062 | 1062 | $key = $this->_string_shift($buffer['encrypted']); |
1063 | - $ciphertext.= $block ^ $key; |
|
1063 | + $ciphertext .= $block ^ $key; |
|
1064 | 1064 | } |
1065 | 1065 | } else { |
1066 | - for ($i = 0; $i < strlen($plaintext); $i+=8) { |
|
1066 | + for ($i = 0; $i < strlen($plaintext); $i += 8) { |
|
1067 | 1067 | $block = substr($plaintext, $i, 8); |
1068 | 1068 | $key = $this->_processBlock($this->_generate_xor($xor), CRYPT_DES_ENCRYPT); |
1069 | - $ciphertext.= $block ^ $key; |
|
1069 | + $ciphertext .= $block ^ $key; |
|
1070 | 1070 | } |
1071 | 1071 | } |
1072 | 1072 | if ($this->continuousBuffer) { |
1073 | 1073 | $this->encryptIV = $xor; |
1074 | 1074 | if ($start = strlen($plaintext) & 7) { |
1075 | - $buffer['encrypted'] = substr($key, $start) . $buffer['encrypted']; |
|
1075 | + $buffer['encrypted'] = substr($key, $start).$buffer['encrypted']; |
|
1076 | 1076 | } |
1077 | 1077 | } |
1078 | 1078 | break; |
@@ -1091,11 +1091,11 @@ discard block |
||
1091 | 1091 | $max = 8 - $pos; |
1092 | 1092 | if ($len >= $max) { |
1093 | 1093 | $i = $max; |
1094 | - $len-= $max; |
|
1094 | + $len -= $max; |
|
1095 | 1095 | $pos = 0; |
1096 | 1096 | } else { |
1097 | 1097 | $i = $len; |
1098 | - $pos+= $len; |
|
1098 | + $pos += $len; |
|
1099 | 1099 | $len = 0; |
1100 | 1100 | } |
1101 | 1101 | $ciphertext = substr($iv, $orig_pos) ^ $plaintext; |
@@ -1103,41 +1103,41 @@ discard block |
||
1103 | 1103 | } |
1104 | 1104 | while ($len >= 8) { |
1105 | 1105 | $iv = $this->_processBlock($iv, CRYPT_DES_ENCRYPT) ^ substr($plaintext, $i, 8); |
1106 | - $ciphertext.= $iv; |
|
1107 | - $len-= 8; |
|
1108 | - $i+= 8; |
|
1106 | + $ciphertext .= $iv; |
|
1107 | + $len -= 8; |
|
1108 | + $i += 8; |
|
1109 | 1109 | } |
1110 | 1110 | if ($len) { |
1111 | 1111 | $iv = $this->_processBlock($iv, CRYPT_DES_ENCRYPT); |
1112 | 1112 | $block = $iv ^ substr($plaintext, $i); |
1113 | 1113 | $iv = substr_replace($iv, $block, 0, $len); |
1114 | - $ciphertext.= $block; |
|
1114 | + $ciphertext .= $block; |
|
1115 | 1115 | $pos = $len; |
1116 | 1116 | } |
1117 | 1117 | return $ciphertext; |
1118 | 1118 | case CRYPT_DES_MODE_OFB: |
1119 | 1119 | $xor = $this->encryptIV; |
1120 | 1120 | if (strlen($buffer['xor'])) { |
1121 | - for ($i = 0; $i < strlen($plaintext); $i+=8) { |
|
1121 | + for ($i = 0; $i < strlen($plaintext); $i += 8) { |
|
1122 | 1122 | $block = substr($plaintext, $i, 8); |
1123 | 1123 | if (strlen($block) > strlen($buffer['xor'])) { |
1124 | 1124 | $xor = $this->_processBlock($xor, CRYPT_DES_ENCRYPT); |
1125 | - $buffer['xor'].= $xor; |
|
1125 | + $buffer['xor'] .= $xor; |
|
1126 | 1126 | } |
1127 | 1127 | $key = $this->_string_shift($buffer['xor']); |
1128 | - $ciphertext.= $block ^ $key; |
|
1128 | + $ciphertext .= $block ^ $key; |
|
1129 | 1129 | } |
1130 | 1130 | } else { |
1131 | - for ($i = 0; $i < strlen($plaintext); $i+=8) { |
|
1131 | + for ($i = 0; $i < strlen($plaintext); $i += 8) { |
|
1132 | 1132 | $xor = $this->_processBlock($xor, CRYPT_DES_ENCRYPT); |
1133 | - $ciphertext.= substr($plaintext, $i, 8) ^ $xor; |
|
1133 | + $ciphertext .= substr($plaintext, $i, 8) ^ $xor; |
|
1134 | 1134 | } |
1135 | 1135 | $key = $xor; |
1136 | 1136 | } |
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 | } |
@@ -1162,7 +1162,7 @@ discard block |
||
1162 | 1162 | $ciphertext = str_pad($ciphertext, (strlen($ciphertext) + 7) & 0xFFFFFFF8, chr(0)); |
1163 | 1163 | } |
1164 | 1164 | |
1165 | - if ( CRYPT_DES_MODE == CRYPT_DES_MODE_MCRYPT ) { |
|
1165 | + if (CRYPT_DES_MODE == CRYPT_DES_MODE_MCRYPT) { |
|
1166 | 1166 | if ($this->dechanged) { |
1167 | 1167 | mcrypt_generic_init($this->demcrypt, $this->keys, $this->decryptIV); |
1168 | 1168 | if ($this->mode == 'ncfb') { |
@@ -1184,11 +1184,11 @@ discard block |
||
1184 | 1184 | $max = 8 - $pos; |
1185 | 1185 | if ($len >= $max) { |
1186 | 1186 | $i = $max; |
1187 | - $len-= $max; |
|
1187 | + $len -= $max; |
|
1188 | 1188 | $pos = 0; |
1189 | 1189 | } else { |
1190 | 1190 | $i = $len; |
1191 | - $pos+= $len; |
|
1191 | + $pos += $len; |
|
1192 | 1192 | $len = 0; |
1193 | 1193 | } |
1194 | 1194 | $plaintext = substr($iv, $orig_pos) ^ $ciphertext; |
@@ -1196,13 +1196,13 @@ discard block |
||
1196 | 1196 | } |
1197 | 1197 | if ($len >= 8) { |
1198 | 1198 | $cb = substr($ciphertext, $i, $len - $len % 8); |
1199 | - $plaintext.= mcrypt_generic($this->ecb, $iv . $cb) ^ $cb; |
|
1199 | + $plaintext .= mcrypt_generic($this->ecb, $iv.$cb) ^ $cb; |
|
1200 | 1200 | $iv = substr($cb, -8); |
1201 | - $len%= 8; |
|
1201 | + $len %= 8; |
|
1202 | 1202 | } |
1203 | 1203 | if ($len) { |
1204 | 1204 | $iv = mcrypt_generic($this->ecb, $iv); |
1205 | - $plaintext.= $iv ^ substr($ciphertext, -$len); |
|
1205 | + $plaintext .= $iv ^ substr($ciphertext, -$len); |
|
1206 | 1206 | $iv = substr_replace($iv, substr($ciphertext, -$len), 0, $len); |
1207 | 1207 | $pos = $len; |
1208 | 1208 | } |
@@ -1230,15 +1230,15 @@ discard block |
||
1230 | 1230 | $plaintext = ''; |
1231 | 1231 | switch ($this->mode) { |
1232 | 1232 | case CRYPT_DES_MODE_ECB: |
1233 | - for ($i = 0; $i < strlen($ciphertext); $i+=8) { |
|
1234 | - $plaintext.= $this->_processBlock(substr($ciphertext, $i, 8), CRYPT_DES_DECRYPT); |
|
1233 | + for ($i = 0; $i < strlen($ciphertext); $i += 8) { |
|
1234 | + $plaintext .= $this->_processBlock(substr($ciphertext, $i, 8), CRYPT_DES_DECRYPT); |
|
1235 | 1235 | } |
1236 | 1236 | break; |
1237 | 1237 | case CRYPT_DES_MODE_CBC: |
1238 | 1238 | $xor = $this->decryptIV; |
1239 | - for ($i = 0; $i < strlen($ciphertext); $i+=8) { |
|
1239 | + for ($i = 0; $i < strlen($ciphertext); $i += 8) { |
|
1240 | 1240 | $block = substr($ciphertext, $i, 8); |
1241 | - $plaintext.= $this->_processBlock($block, CRYPT_DES_DECRYPT) ^ $xor; |
|
1241 | + $plaintext .= $this->_processBlock($block, CRYPT_DES_DECRYPT) ^ $xor; |
|
1242 | 1242 | $xor = $block; |
1243 | 1243 | } |
1244 | 1244 | if ($this->continuousBuffer) { |
@@ -1248,25 +1248,25 @@ discard block |
||
1248 | 1248 | case CRYPT_DES_MODE_CTR: |
1249 | 1249 | $xor = $this->decryptIV; |
1250 | 1250 | if (strlen($buffer['ciphertext'])) { |
1251 | - for ($i = 0; $i < strlen($ciphertext); $i+=8) { |
|
1251 | + for ($i = 0; $i < strlen($ciphertext); $i += 8) { |
|
1252 | 1252 | $block = substr($ciphertext, $i, 8); |
1253 | 1253 | if (strlen($block) > strlen($buffer['ciphertext'])) { |
1254 | - $buffer['ciphertext'].= $this->_processBlock($this->_generate_xor($xor), CRYPT_DES_ENCRYPT); |
|
1254 | + $buffer['ciphertext'] .= $this->_processBlock($this->_generate_xor($xor), CRYPT_DES_ENCRYPT); |
|
1255 | 1255 | } |
1256 | 1256 | $key = $this->_string_shift($buffer['ciphertext']); |
1257 | - $plaintext.= $block ^ $key; |
|
1257 | + $plaintext .= $block ^ $key; |
|
1258 | 1258 | } |
1259 | 1259 | } else { |
1260 | - for ($i = 0; $i < strlen($ciphertext); $i+=8) { |
|
1260 | + for ($i = 0; $i < strlen($ciphertext); $i += 8) { |
|
1261 | 1261 | $block = substr($ciphertext, $i, 8); |
1262 | 1262 | $key = $this->_processBlock($this->_generate_xor($xor), CRYPT_DES_ENCRYPT); |
1263 | - $plaintext.= $block ^ $key; |
|
1263 | + $plaintext .= $block ^ $key; |
|
1264 | 1264 | } |
1265 | 1265 | } |
1266 | 1266 | if ($this->continuousBuffer) { |
1267 | 1267 | $this->decryptIV = $xor; |
1268 | 1268 | if ($start = strlen($ciphertext) % 8) { |
1269 | - $buffer['ciphertext'] = substr($key, $start) . $buffer['ciphertext']; |
|
1269 | + $buffer['ciphertext'] = substr($key, $start).$buffer['ciphertext']; |
|
1270 | 1270 | } |
1271 | 1271 | } |
1272 | 1272 | break; |
@@ -1285,11 +1285,11 @@ discard block |
||
1285 | 1285 | $max = 8 - $pos; |
1286 | 1286 | if ($len >= $max) { |
1287 | 1287 | $i = $max; |
1288 | - $len-= $max; |
|
1288 | + $len -= $max; |
|
1289 | 1289 | $pos = 0; |
1290 | 1290 | } else { |
1291 | 1291 | $i = $len; |
1292 | - $pos+= $len; |
|
1292 | + $pos += $len; |
|
1293 | 1293 | $len = 0; |
1294 | 1294 | } |
1295 | 1295 | $plaintext = substr($iv, $orig_pos) ^ $ciphertext; |
@@ -1298,14 +1298,14 @@ discard block |
||
1298 | 1298 | while ($len >= 8) { |
1299 | 1299 | $iv = $this->_processBlock($iv, CRYPT_DES_ENCRYPT); |
1300 | 1300 | $cb = substr($ciphertext, $i, 8); |
1301 | - $plaintext.= $iv ^ $cb; |
|
1301 | + $plaintext .= $iv ^ $cb; |
|
1302 | 1302 | $iv = $cb; |
1303 | - $len-= 8; |
|
1304 | - $i+= 8; |
|
1303 | + $len -= 8; |
|
1304 | + $i += 8; |
|
1305 | 1305 | } |
1306 | 1306 | if ($len) { |
1307 | 1307 | $iv = $this->_processBlock($iv, CRYPT_DES_ENCRYPT); |
1308 | - $plaintext.= $iv ^ substr($ciphertext, $i); |
|
1308 | + $plaintext .= $iv ^ substr($ciphertext, $i); |
|
1309 | 1309 | $iv = substr_replace($iv, substr($ciphertext, $i), 0, $len); |
1310 | 1310 | $pos = $len; |
1311 | 1311 | } |
@@ -1313,26 +1313,26 @@ discard block |
||
1313 | 1313 | case CRYPT_DES_MODE_OFB: |
1314 | 1314 | $xor = $this->decryptIV; |
1315 | 1315 | if (strlen($buffer['xor'])) { |
1316 | - for ($i = 0; $i < strlen($ciphertext); $i+=8) { |
|
1316 | + for ($i = 0; $i < strlen($ciphertext); $i += 8) { |
|
1317 | 1317 | $block = substr($ciphertext, $i, 8); |
1318 | 1318 | if (strlen($block) > strlen($buffer['xor'])) { |
1319 | 1319 | $xor = $this->_processBlock($xor, CRYPT_DES_ENCRYPT); |
1320 | - $buffer['xor'].= $xor; |
|
1320 | + $buffer['xor'] .= $xor; |
|
1321 | 1321 | } |
1322 | 1322 | $key = $this->_string_shift($buffer['xor']); |
1323 | - $plaintext.= $block ^ $key; |
|
1323 | + $plaintext .= $block ^ $key; |
|
1324 | 1324 | } |
1325 | 1325 | } else { |
1326 | - for ($i = 0; $i < strlen($ciphertext); $i+=8) { |
|
1326 | + for ($i = 0; $i < strlen($ciphertext); $i += 8) { |
|
1327 | 1327 | $xor = $this->_processBlock($xor, CRYPT_DES_ENCRYPT); |
1328 | - $plaintext.= substr($ciphertext, $i, 8) ^ $xor; |
|
1328 | + $plaintext .= substr($ciphertext, $i, 8) ^ $xor; |
|
1329 | 1329 | } |
1330 | 1330 | $key = $xor; |
1331 | 1331 | } |
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 | } |
@@ -2100,7 +2100,7 @@ discard block |
||
2100 | 2100 | */ |
2101 | 2101 | function inline_crypt_setup($des_rounds = 1) |
2102 | 2102 | { |
2103 | - $lambda_functions =& Crypt_DES::get_lambda_functions(); |
|
2103 | + $lambda_functions = & Crypt_DES::get_lambda_functions(); |
|
2104 | 2104 | $block_size = 8; |
2105 | 2105 | $mode = $this->mode; |
2106 | 2106 | |
@@ -2139,7 +2139,7 @@ discard block |
||
2139 | 2139 | ($shuffle[$ipmap[($l >> 24) & 0xFF]] & "\x01\x01\x01\x01\x01\x01\x01\x01") |
2140 | 2140 | ); |
2141 | 2141 | |
2142 | - '.'' /* Extract L0 and R0 */ .' |
|
2142 | + '.'' /* Extract L0 and R0 */.' |
|
2143 | 2143 | $l = $in[1]; |
2144 | 2144 | $r = $in[2]; |
2145 | 2145 | '; |
@@ -2153,19 +2153,19 @@ discard block |
||
2153 | 2153 | // Merge key schedule. |
2154 | 2154 | for ($i = 0; $i < 8; ++$i) { |
2155 | 2155 | $_cryptBlock .= ' |
2156 | - $b1 = (($' . $r . ' >> 3) & 0x1FFFFFFF) ^ ($' . $r . ' << 29) ^ $k_'.(++$ki).'; |
|
2157 | - $b2 = (($' . $r . ' >> 31) & 0x00000001) ^ ($' . $r . ' << 1) ^ $k_'.(++$ki).'; |
|
2158 | - $' . $l . ' = $sbox1[($b1 >> 24) & 0x3F] ^ $sbox2[($b2 >> 24) & 0x3F] ^ |
|
2156 | + $b1 = (($' . $r.' >> 3) & 0x1FFFFFFF) ^ ($'.$r.' << 29) ^ $k_'.(++$ki).'; |
|
2157 | + $b2 = (($' . $r.' >> 31) & 0x00000001) ^ ($'.$r.' << 1) ^ $k_'.(++$ki).'; |
|
2158 | + $' . $l.' = $sbox1[($b1 >> 24) & 0x3F] ^ $sbox2[($b2 >> 24) & 0x3F] ^ |
|
2159 | 2159 | $sbox3[($b1 >> 16) & 0x3F] ^ $sbox4[($b2 >> 16) & 0x3F] ^ |
2160 | 2160 | $sbox5[($b1 >> 8) & 0x3F] ^ $sbox6[($b2 >> 8) & 0x3F] ^ |
2161 | - $sbox7[ $b1 & 0x3F] ^ $sbox8[ $b2 & 0x3F] ^ $' . $l . '; |
|
2161 | + $sbox7[ $b1 & 0x3F] ^ $sbox8[ $b2 & 0x3F] ^ $' . $l.'; |
|
2162 | 2162 | |
2163 | - $b1 = (($' . $l . ' >> 3) & 0x1FFFFFFF) ^ ($' . $l . ' << 29) ^ $k_'.(++$ki).'; |
|
2164 | - $b2 = (($' . $l . ' >> 31) & 0x00000001) ^ ($' . $l . ' << 1) ^ $k_'.(++$ki).'; |
|
2165 | - $' . $r . ' = $sbox1[($b1 >> 24) & 0x3F] ^ $sbox2[($b2 >> 24) & 0x3F] ^ |
|
2163 | + $b1 = (($' . $l.' >> 3) & 0x1FFFFFFF) ^ ($'.$l.' << 29) ^ $k_'.(++$ki).'; |
|
2164 | + $b2 = (($' . $l.' >> 31) & 0x00000001) ^ ($'.$l.' << 1) ^ $k_'.(++$ki).'; |
|
2165 | + $' . $r.' = $sbox1[($b1 >> 24) & 0x3F] ^ $sbox2[($b2 >> 24) & 0x3F] ^ |
|
2166 | 2166 | $sbox3[($b1 >> 16) & 0x3F] ^ $sbox4[($b2 >> 16) & 0x3F] ^ |
2167 | 2167 | $sbox5[($b1 >> 8) & 0x3F] ^ $sbox6[($b2 >> 8) & 0x3F] ^ |
2168 | - $sbox7[ $b1 & 0x3F] ^ $sbox8[ $b2 & 0x3F] ^ $' . $r . '; |
|
2168 | + $sbox7[ $b1 & 0x3F] ^ $sbox8[ $b2 & 0x3F] ^ $' . $r.'; |
|
2169 | 2169 | '; |
2170 | 2170 | } |
2171 | 2171 | |
@@ -2177,21 +2177,21 @@ discard block |
||
2177 | 2177 | |
2178 | 2178 | // Perform the inverse IP permutation. |
2179 | 2179 | $_cryptBlock .= '$in = ( |
2180 | - ($shuffle[$invipmap[($' . $r . ' >> 24) & 0xFF]] & "\x80\x80\x80\x80\x80\x80\x80\x80") | |
|
2181 | - ($shuffle[$invipmap[($' . $l . ' >> 24) & 0xFF]] & "\x40\x40\x40\x40\x40\x40\x40\x40") | |
|
2182 | - ($shuffle[$invipmap[($' . $r . ' >> 16) & 0xFF]] & "\x20\x20\x20\x20\x20\x20\x20\x20") | |
|
2183 | - ($shuffle[$invipmap[($' . $l . ' >> 16) & 0xFF]] & "\x10\x10\x10\x10\x10\x10\x10\x10") | |
|
2184 | - ($shuffle[$invipmap[($' . $r . ' >> 8) & 0xFF]] & "\x08\x08\x08\x08\x08\x08\x08\x08") | |
|
2185 | - ($shuffle[$invipmap[($' . $l . ' >> 8) & 0xFF]] & "\x04\x04\x04\x04\x04\x04\x04\x04") | |
|
2186 | - ($shuffle[$invipmap[ $' . $r . ' & 0xFF]] & "\x02\x02\x02\x02\x02\x02\x02\x02") | |
|
2187 | - ($shuffle[$invipmap[ $' . $l . ' & 0xFF]] & "\x01\x01\x01\x01\x01\x01\x01\x01") |
|
2180 | + ($shuffle[$invipmap[($' . $r.' >> 24) & 0xFF]] & "\x80\x80\x80\x80\x80\x80\x80\x80") | |
|
2181 | + ($shuffle[$invipmap[($' . $l.' >> 24) & 0xFF]] & "\x40\x40\x40\x40\x40\x40\x40\x40") | |
|
2182 | + ($shuffle[$invipmap[($' . $r.' >> 16) & 0xFF]] & "\x20\x20\x20\x20\x20\x20\x20\x20") | |
|
2183 | + ($shuffle[$invipmap[($' . $l.' >> 16) & 0xFF]] & "\x10\x10\x10\x10\x10\x10\x10\x10") | |
|
2184 | + ($shuffle[$invipmap[($' . $r.' >> 8) & 0xFF]] & "\x08\x08\x08\x08\x08\x08\x08\x08") | |
|
2185 | + ($shuffle[$invipmap[($' . $l.' >> 8) & 0xFF]] & "\x04\x04\x04\x04\x04\x04\x04\x04") | |
|
2186 | + ($shuffle[$invipmap[ $' . $r.' & 0xFF]] & "\x02\x02\x02\x02\x02\x02\x02\x02") | |
|
2187 | + ($shuffle[$invipmap[ $' . $l.' & 0xFF]] & "\x01\x01\x01\x01\x01\x01\x01\x01") |
|
2188 | 2188 | ); |
2189 | 2189 | '; |
2190 | 2190 | |
2191 | 2191 | // Generating mode of operation code: |
2192 | 2192 | switch ($mode) { |
2193 | 2193 | case CRYPT_DES_MODE_ECB: |
2194 | - $encrypt = $init_cryptBlock . ' |
|
2194 | + $encrypt = $init_cryptBlock.' |
|
2195 | 2195 | extract($self->keys[CRYPT_DES_ENCRYPT_1DIM], EXTR_PREFIX_ALL, "k"); |
2196 | 2196 | $ciphertext = ""; |
2197 | 2197 | $plaintext_len = strlen($text); |
@@ -2205,7 +2205,7 @@ discard block |
||
2205 | 2205 | return $ciphertext; |
2206 | 2206 | '; |
2207 | 2207 | |
2208 | - $decrypt = $init_cryptBlock . ' |
|
2208 | + $decrypt = $init_cryptBlock.' |
|
2209 | 2209 | extract($self->keys[CRYPT_DES_DECRYPT_1DIM], EXTR_PREFIX_ALL, "k"); |
2210 | 2210 | $plaintext = ""; |
2211 | 2211 | $ciphertext_len = strlen($text); |
@@ -2220,7 +2220,7 @@ discard block |
||
2220 | 2220 | '; |
2221 | 2221 | break; |
2222 | 2222 | case CRYPT_DES_MODE_CBC: |
2223 | - $encrypt = $init_cryptBlock . ' |
|
2223 | + $encrypt = $init_cryptBlock.' |
|
2224 | 2224 | extract($self->keys[CRYPT_DES_ENCRYPT_1DIM], EXTR_PREFIX_ALL, "k"); |
2225 | 2225 | $ciphertext = ""; |
2226 | 2226 | $plaintext_len = strlen($text); |
@@ -2240,7 +2240,7 @@ discard block |
||
2240 | 2240 | return $ciphertext; |
2241 | 2241 | '; |
2242 | 2242 | |
2243 | - $decrypt = $init_cryptBlock . ' |
|
2243 | + $decrypt = $init_cryptBlock.' |
|
2244 | 2244 | extract($self->keys[CRYPT_DES_DECRYPT_1DIM], EXTR_PREFIX_ALL, "k"); |
2245 | 2245 | $plaintext = ""; |
2246 | 2246 | $ciphertext_len = strlen($text); |
@@ -2262,7 +2262,7 @@ discard block |
||
2262 | 2262 | '; |
2263 | 2263 | break; |
2264 | 2264 | case CRYPT_DES_MODE_CTR: |
2265 | - $encrypt = $init_cryptBlock . ' |
|
2265 | + $encrypt = $init_cryptBlock.' |
|
2266 | 2266 | extract($self->keys[CRYPT_DES_ENCRYPT_1DIM], EXTR_PREFIX_ALL, "k"); |
2267 | 2267 | $ciphertext = ""; |
2268 | 2268 | $plaintext_len = strlen($text); |
@@ -2299,7 +2299,7 @@ discard block |
||
2299 | 2299 | return $ciphertext; |
2300 | 2300 | '; |
2301 | 2301 | |
2302 | - $decrypt = $init_cryptBlock . ' |
|
2302 | + $decrypt = $init_cryptBlock.' |
|
2303 | 2303 | extract($self->keys[CRYPT_DES_ENCRYPT_1DIM], EXTR_PREFIX_ALL, "k"); |
2304 | 2304 | $plaintext = ""; |
2305 | 2305 | $ciphertext_len = strlen($text); |
@@ -2337,7 +2337,7 @@ discard block |
||
2337 | 2337 | '; |
2338 | 2338 | break; |
2339 | 2339 | case CRYPT_DES_MODE_CFB: |
2340 | - $encrypt = $init_cryptBlock . ' |
|
2340 | + $encrypt = $init_cryptBlock.' |
|
2341 | 2341 | extract($self->keys[CRYPT_DES_ENCRYPT_1DIM], EXTR_PREFIX_ALL, "k"); |
2342 | 2342 | $ciphertext = ""; |
2343 | 2343 | $buffer = &$self->enbuffer; |
@@ -2386,7 +2386,7 @@ discard block |
||
2386 | 2386 | return $ciphertext; |
2387 | 2387 | '; |
2388 | 2388 | |
2389 | - $decrypt = $init_cryptBlock . ' |
|
2389 | + $decrypt = $init_cryptBlock.' |
|
2390 | 2390 | extract($self->keys[CRYPT_DES_ENCRYPT_1DIM], EXTR_PREFIX_ALL, "k"); |
2391 | 2391 | $plaintext = ""; |
2392 | 2392 | $buffer = &$self->debuffer; |
@@ -2438,7 +2438,7 @@ discard block |
||
2438 | 2438 | '; |
2439 | 2439 | break; |
2440 | 2440 | case CRYPT_DES_MODE_OFB: |
2441 | - $encrypt = $init_cryptBlock . ' |
|
2441 | + $encrypt = $init_cryptBlock.' |
|
2442 | 2442 | extract($self->keys[CRYPT_DES_ENCRYPT_1DIM], EXTR_PREFIX_ALL, "k"); |
2443 | 2443 | $ciphertext = ""; |
2444 | 2444 | $plaintext_len = strlen($text); |
@@ -2475,7 +2475,7 @@ discard block |
||
2475 | 2475 | return $ciphertext; |
2476 | 2476 | '; |
2477 | 2477 | |
2478 | - $decrypt = $init_cryptBlock . ' |
|
2478 | + $decrypt = $init_cryptBlock.' |
|
2479 | 2479 | extract($self->keys[CRYPT_DES_ENCRYPT_1DIM], EXTR_PREFIX_ALL, "k"); |
2480 | 2480 | $plaintext = ""; |
2481 | 2481 | $ciphertext_len = strlen($text); |