Need a unique gift idea?
A Pastebin account makes a great Christmas gift
SHARE
TWEET

Untitled

a guest Dec 14th, 2017 54 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  1. <?php
  2.  
  3. define('PART', 1); // 1 or 2
  4.  
  5. $pos = 0;
  6. $skip = 0;
  7. $list = range(0, 255);
  8. $size = count($list);
  9. $run = 0;
  10.  
  11. // $input = '1,2,3';
  12. $input = '83,0,193,1,254,237,187,40,88,27,2,255,149,29,42,100';
  13.  
  14. if(PART == 1)
  15. {
  16.     foreach(explode(',', $input) as $length)
  17.     {
  18.         $length = intval($length);
  19.  
  20.         $indices = array();
  21.         for($i = 0; $i < $length; $i += 1)
  22.         {
  23.             $indices[] = ($pos + $i) % $size;
  24.         }
  25.  
  26.         $reversed = array();
  27.         foreach($indices as $idx)
  28.         {
  29.             $reversed[] = $list[$idx];
  30.         }
  31.         $reversed = array_reverse($reversed);
  32.  
  33.         foreach($indices as $i => $idx)
  34.         {
  35.             $list[$idx] = $reversed[$i];
  36.         }
  37.  
  38.         $pos = ($pos + $length + $skip) % $size;
  39.         $skip += 1;
  40.     }
  41.  
  42.     echo $list[0].' x '.$list[1].' = '.$list[0] * $list[1]."\r\n";
  43. }
  44. else
  45. {
  46.     $actual_input = array();
  47.     foreach(str_split($input) as $char)
  48.     {
  49.         $actual_input[] = ord($char);
  50.     }
  51.     $actual_input = array_merge($actual_input, array(17, 31, 73, 47, 23));
  52.  
  53.     while($run < 64)
  54.     {
  55.         foreach($actual_input as $length)
  56.         {
  57.             $length = intval($length);
  58.  
  59.             $indices = array();
  60.             for($i = 0; $i < $length; $i += 1)
  61.             {
  62.                 $indices[] = ($pos + $i) % $size;
  63.             }
  64.  
  65.             $reversed = array();
  66.             foreach($indices as $idx)
  67.             {
  68.                 $reversed[] = $list[$idx];
  69.             }
  70.             $reversed = array_reverse($reversed);
  71.  
  72.             foreach($indices as $i => $idx)
  73.             {
  74.                 $list[$idx] = $reversed[$i];
  75.             }
  76.  
  77.             $pos = ($pos + $length + $skip) % $size;
  78.             $skip += 1;
  79.         }
  80.  
  81.         $run += 1;
  82.     }
  83.  
  84.     $dense = array();
  85.     foreach(array_chunk($list, 16) as $part)
  86.     {
  87.         $result = 0;
  88.         foreach($part as $number)
  89.         {
  90.             $result ^= $number;
  91.         }
  92.         $dense[] = $result;
  93.     }
  94.  
  95.     $output = '';
  96.     foreach($dense as $d)
  97.     {
  98.         $output .= dechex($d);
  99.     }
  100.  
  101.     echo 'Result: '.$output."\r\n";
  102. }
  103.  
  104. ?>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top