function rotieren($alfa, $key)
{
    // Rotiert ein Alfabet
    for ($t = 0; $t < sizeof($alfa); $t++) {
        $alfa2[$t] = buchstabeVonIndex($alfa, (indexVonBuchstabe($alfa, $alfa[$t]) + $key) % sizeof($alfa));
    }
    return $alfa2;
}
function substituiere($text, $alfa1, $alfa2)
{
    // Algorithmus zur Umsetzung eines Textes aus einem Alfabet in ein anderes
    // dies ist eine Ersetzung des Zeichen aus alfa1 durch das Zeichen an der selben Stelle in alfa2
    $laengetxt = strlen($text);
    for ($t = 0; $t < $laengetxt; $t = $t + 1) {
        $buchstabe = buchstabeVonIndex($alfa2, indexVonBuchstabe($alfa1, substr($text, $t, 1)));
        $codtext = $codtext . $buchstabe;
    }
    return $codtext;
}
示例#3
0
function findpw($text, $pwl)
{
    # Passwort ermitteln für Vigenère
    global $alfa;
    $texte = trennen($text, $pwl);
    for ($t = 0; $t < sizeof($texte); $t++) {
        $rot[$t] = findrot($texte[$t]);
        $pass = $pass . buchstabeVonIndex($alfa, $rot[$t]);
    }
    return $pass;
}
示例#4
0
        $mkey = array_search($mulv, $mulzahl);
        $mulv = $mulzahl[($mkey - 1) % sizeof($mulzahl)];
        unset($mult);
    }
    if ($rott) {
        $rotv = findrot($codtxt);
    }
    if ($mult) {
        $mulv = findmul($codtxt);
        $alfa2 = createMulAlfa($alfa, $mulv);
        $rotv = 0;
    }
    $alfa2 = createMulAlfa($alfa, $mulv);
    $codtxt = substituiere($codtxt, $alfa2, $alfa);
    $codtxt = dekodieren($codtxt, buchstabeVonIndex($alfa, $rotv), $alfa);
    $codtxt = kodieren($codtxt, buchstabeVonIndex($alfa, $rotv), $alfa);
    $codtxt = substituiere($codtxt, $alfa, $alfa2);
}
$lang_multiplier = JTEXT::_('MULTIPLIER');
$lang_frequency = JTEXT::_('FREQUENCYANALYSIS');
$inhalt .= '
<form name=formular method=post>
<table border=0>
    <tr>
        <td colspan=2>
            <table>
            <tr>
            <td>
            <textarea name=codtxt class="ctoformcss-txtinput-style ctoformcss-default-input-size" onClick="this.formular.codtxt.select();this.formular.codtxt.focus()">' . spacing(strtoupper($codtxt), $spacing) . '</textarea>
            </td>
            <td valign=middle><script type="text/javascript" src=js/ie_copy_codtxt.js></script></td>