} // http://php.net/manual/en/function.str-rot13.php#107475 function str_rot($s, $n = 13) { static $letters = 'AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz'; $n = (int) $n % 26; if (!$n) { return $s; } if ($n < 0) { $n += 26; } if ($n == 13) { return str_rot13($s); } $rep = substr($letters, $n * 2) . substr($letters, 0, $n * 2); return strtr($s, $letters, $rep); } foreach ($rooms as $room) { $pieces = explode('-', $room); $piece2 = array_pop($pieces); $pieces2 = explode('[', $piece2); $roomData = ['name' => implode('-', $pieces), 'checkName' => implode('', $pieces), 'sector' => $pieces2[0], 'checksum' => substr($pieces2[1], 0, -1)]; $validCheck = substr(implode('', lettersByAmount($roomData['checkName'])), 0, strlen($roomData['checksum'])); if ($validCheck == $roomData['checksum']) { $roomData['name'] = str_rot($roomData['name'], $roomData['sector']); if ($roomData['name'] == 'northpole-object-storage') { echo 'North Pole Object Storage, Sector ' . $roomData['sector'], PHP_EOL; } } }
return TRUE; } } return FALSE; } $usenet = fsockopen("54.209.5.48", "12345", $errno, $errstr, 3); first: while (!feof($usenet)) { $kp = fgets($usenet, 128); if (inStr("psifer text:", $kp)) { $kp = explode("psifer text: ", $kp); $kp = $kp[1]; $kp = explode("\n", $kp); $kp = $kp[0]; for ($i = 0; $i < 25; $i++) { $temp = str_rot($kp, $i) . "\n"; if (instr("the answer to this stage is", $temp)) { $temp = explode("the answer to this stage is ", $temp); $temp = $temp[1]; goto second; } } } } second: fputs($usenet, $temp); while (!feof($usenet)) { $kp = fgets($usenet, 260); if (inStr("psifer text:", $kp)) { $kp = explode("psifer text: ", $kp); $kp = $kp[1];
<td><input type=submit name=encrypt value='encrypt'></input></td></tr> </table> </body> <?php if (isset($_POST['encrypt'])) { $a = $_POST['iword']; } function str_rot($s, $n = 1) { static $letters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; $n = (int) $n % 26; if (!$n) { return $s; } if ($n == 13) { return str_rot13($s); } for ($i = 0, $l = strlen($s); $i < $l; $i++) { $c = $s[$i]; if ($c >= 'a' && $c <= 'z') { $s[$i] = $letters[(ord($c) - 71 + $n) % 26]; } else { if ($c >= 'A' && $c <= 'Z') { $s[$i] = $letters[(ord($c) - 39 + $n) % 26 + 26]; } } } return $s; } print str_rot($a);
$c = $s[$i]; if ($c >= 'a' && $c <= 'z') { $s[$i] = $letters[(ord($c) - 71 + $n) % 26]; } else { if ($c >= 'A' && $c <= 'Z') { $s[$i] = $letters[(ord($c) - 39 + $n) % 26 + 26]; } } } return $s; } if (isset($_POST['encrypt'])) { $a = $_POST['iword']; $a = str_replace(" ", "", $a); $key1 = "cad"; $key = str_rot($key1); $keyLength = strlen($key); $keyIndex = 0; $message = str_split($a); $output = ''; foreach ($message as $value) { $thisValueASCII = ord($value); if ($thisValueASCII >= 65 && $thisValueASCII <= 90) { $thisValueASCIIOffset = 65; } else { $thisValueASCIIOffset = 97; } $letter_value_corrected = $thisValueASCII - $thisValueASCIIOffset; $key_index_corrected = $keyIndex % $keyLength; // This is the same as fmod but I prefer this notation. $key_ascii_value = ord($key[$key_index_corrected]);
if ($n == 13) { return str_rot13($s); } for ($i = 0, $l = strlen($s); $i < $l; $i++) { $c = $s[$i]; if ($c >= 'a' && $c <= 'z') { $s[$i] = $letters[(ord($c) - 71 + $n) % 26]; } else { if ($c >= 'A' && $c <= 'Z') { $s[$i] = $letters[(ord($c) - 39 + $n) % 26 + 26]; } } } return $s; } print "<br><br><br> Encrypted Words: " . str_rot($a); ?> </div> </body> <div id="footer"> <br> <center><font face = "Arial" color = "white" size = "2"><b> Copyright (c) 2015. JAGUARS encryption . All Rights Reserved
if ($n == 13) { return str_rot13($s); } for ($i = 0, $l = strlen($s); $i < $l; $i++) { $c = $s[$i]; if ($c >= 'a' && $c <= 'z') { $s[$i] = $letters[(ord($c) - 71 + $n) % 26]; } else { if ($c >= 'A' && $c <= 'Z') { $s[$i] = $letters[(ord($c) - 39 + $n) % 26 + 26]; } } } return $s; } $ro = str_rot($a); print "<br><br><br> Encrypted Words: " . strrev($ro); ?> </div> </body> <div id="footer"> <br> <center><font face = "Arial" color = "white" size = "2"><b>