function findpw_ak($text, $pwl) { # Passwort ermitteln für Autokey global $alfa; global $AP; $texte = trennen($text, $pwl); for ($t = 0; $t < sizeof($texte); $t++) { unset($arr); for ($u = 0; $u < sizeof($alfa); $u++) { $arr[] = koinzidenzIndex(dekAutokey($texte[$t], $alfa[$u], $alfa)); } #echo '<br>'; $y[$t][0] = array_search(min($arr), $arr); #echo $alfa[$y[$t][0]].$y[$t][0]." "; $arr2 = array_merge(array_slice($arr, 0, $y[$t][0] - 1), array_slice($arr, $y[$t][0] + 1, sizeof($arr))); $y[$t][1] = array_search(min($arr2), $arr2); if ($y[$t][1] >= $y[$t][0]) { $y[$t][1]++; $y[$t][1]++; } #echo $alfa[$y[$t][1]].$y[$t][1]; $rot1 = abs(13 - findrot(dekAutokey($texte[$t], $alfa[$y[$t][0]], $alfa))); $rot2 = abs(13 - findrot(dekAutokey($texte[$t], $alfa[$y[$t][1]], $alfa))); #echo ' '.$rot1.' '.$rot2; if ($rot1 == 13) { $letter = $alfa[$y[$t][0]]; } if ($rot2 == 13) { $letter = $alfa[$y[$t][1]]; } $pass = $pass . $letter; } return $pass; }
if (!function_exists("normalisiere")) { #require "dll_globals_on.php"; require "alfa_dat.php"; require "fkt_coder.php"; require "fkt_decipher.php"; } $spacing = 5; $orgtxt = strtoupper(normalisiere($orgtxt, $alfa)); $codtxt = strtoupper(normalisiere($codtxt, $alfa)); $key = strtoupper(normalisiere($key, $alfa)); if ($key == "") { $key = "CODE"; } if (isset($_POST['decode'])) { $sel1 = "SELECTED"; $orgtxt = dekAutokey($codtxt, $key, $alfa); } if (isset($_POST['encode']) || !isset($_POST['decode']) && !isset($_POST['encode']) && $firsttime == TRUE) { $sel2 = "SELECTED"; $codtxt = kodAutokey($orgtxt, $key, $alfa); } if ($sel1) { $sObj0 = "=>"; } else { $sObj0 = " "; } if ($sel2) { $sObj1 = "=>"; } else { $sObj1 = " "; }