<html>
<head>
<title>Marno's Homepage :: Encryption Result</title>
<link type="text/css" rel="stylesheet" href="/style.css">
</head>
<body>
<h1 class="orange">Encryption result</h1>
<table style="margin-right: 10%;">
<tr>
<td>
<?php
  
include('../include.php');

  
// if there is input..
  
if ($text != "") {

  
// simple output
  
echo "Plain: </td><td><b>" $text "</b> (" $textLength " chars)</td></tr><tr><td colspan=2>&nbsp;</td></tr><tr><td>Encrypted:";
  
  
// initialize counter
  
$counter $n_rand;
  
  
// loop to convert every character
  
for ($x 0$x $textLength$x++) {
    
// Check to see if it's valid ASCII according to _OUR_ ascii table
    
if (in_array($text{$x}, $ascii)) {
      
// Get the number of the character in OUR ascii table
      
$index array_search($text{$x}, $ascii);
      
#$scrmbl2 = $hex[rand(1,15)];
      
      // Reinitialize the counter if the counter is greater than the scramblecode (cool word)
      
if ($counter $n_rand 3) { # + (array_search($scmbl2, $hex) - 5)) {
        
$counter=0;
      }
      
      
// THEN calculate oindex      
      
$oindex $index $counter;
      
      
// and put the encrypted value in the char array
      
$char[] = $ascii[$oindex];
      
    } else {
      
// This isn't ascii according to our current ascii table
      
echo "<br>$x: Error! This is not ascii now is it? <h1>" $text{$x} . "</h1>";
    }

    
// Uncomment to enable debug output (with offsets/indexes etc)
    #echo "<br>" . $text{$x} . " => " . $char[$x] . " Offset: " . $counter . " Index: " . $oindex;

    
$counter++;
  }
  echo 
"</td><td><b>";

  
// prepend the random number to the string
  
echo $rand;

  
// walk through the char array to output it
  
for ($j 0$j count($char); $j++) {
      echo 
$char[$j];
  }
  
  
#echo $hex[$scrmbl2];
    
  // calculate the number of characters (excluding scramblecode)
  
echo "</b> <font color=green>(" . (count($char) + 1) . " chars)</font>";
  } else {
    echo 
"Invalid Input!";
  }
?>
</td></tr></table><br>
-------------------------------------------------------<br><? echo $version?>
</body>
</html>