<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Probleme beim erstellen von Vigenère Cipher]]></title><description><![CDATA[<p>Hallo, bin dabei ein Programm zu entwickeln, dass mir eine Eingabe nach<br />
Vigenère Cipher chiffriert, diese ausgibt und wenn man dann wieder das richtige Passwort eingibt, wieder richtig dechiffriert.<br />
Ich bin eigentlich so ziemlich fertig mit dem Programm, jedoch stimmt wahrscheinlich mein chiffriercode nicht, kann mir da vielleicht jemand helfen, ich blicke nicht mehr durch. Nach meiner Ansicht sollte alles stimmen.</p>
<p><a href="http://en.wikipedia.org/wiki/Vigen%C3%A8re_cipher" rel="nofollow">http://en.wikipedia.org/wiki/Vigenère_cipher</a></p>
<pre><code class="language-cpp">[code]
#include &lt;iostream&gt;
#include &lt;cmath&gt;
#include &lt;climits&gt;
#include &lt;cstring&gt;

using namespace std;

//*****************************************************************************
//Dieses Register führt eine TestArray ein, um länge anzupassen.
//*****************************************************************************

int main()
{
    char test[256]; //dient zur stringkuerzung
    cout &lt;&lt; &quot;Geben sie einen zu kodierenden Satz ein:\n&quot;;
    cout &lt;&lt; &quot;\n&quot;;
    cin.getline (test,256);

    int q = (strlen(test));

    char phrase[q];

    for (int x=0; x&lt;q; x++)
    {
           phrase[x] = test[x];
        }  

    char test2[64]; //dient zur stringkuerzung
    cout &lt;&lt; &quot;\n&quot;;
    cout &lt;&lt; &quot;Geben sie ein Passwort ein:\n&quot;;
    cout &lt;&lt; &quot;\n&quot;;

    cin.getline (test2,64);

    int r = (strlen(test2));

    char password[r];
    char password2[q];

    for (int y=0; y&lt;r; y++)
    {
            password[y] = test2[y];
        }    

//*****************************************************************************
//Dieses Register enthält die Umrechnung.
//*****************************************************************************

    for (int i = 0; i &lt; q ; i++)
    {
        if (isalpha(phrase[i]))
        {
            phrase[i] =  (phrase[i] - 32);
            }
        else
        {
            ;
        }
        }

    for (int j = 0; j &lt; r ; j++)
    {
        if (isalpha(password[j]))
        {
            password[j] = password[j] - 32;
            }
        else
        {
            ;
        }
        }

//*****************************************************************************
//Dieses Register enthaelt die Streckung des Passwortes auf die Länge von phrase
//*****************************************************************************

    if (q&lt;=r)
    {
            for (int s =0; s&lt;q; s++)
            {        password2[s] = password[s];
                     }
            }

    if (r&lt;q)
    {
            int t = 0;
            int w = r;
            for ( ; w&lt;q ; )
            {
                if (t&lt;r)
                {   for ( ; t&lt;r; t++)
                    {        password2[t] = password[t];
                             }
                    }

                t= r+1;

                if (t&gt;r)
                {
                    int l =0;
                    for ( ; l&lt;r &amp;&amp; w&lt;q ;l++)
                    {
                             password2[w] = password[l];
                             w++;
                             } 
                    l=0;
                    } 
            }
    } 

    cout &lt;&lt; &quot;\n&quot;;     

//*****************************************************************************
//Dieses Register enthaelt die Funktion.
//*****************************************************************************

    for (int h = 0; h &lt; q ; h++)
    {
        if (isalpha(phrase[h]))
        {
            phrase[h] = (phrase[h] + (password[h]%26));
            }
        } 

    cout &lt;&lt; phrase;    

    cout &lt;&lt; &quot;\n&quot;;

//*****************************************************************************
//Dieses Register enthaelt Die Rückfunktion
//*****************************************************************************        

    cout &lt;&lt; &quot;\n&quot;;
    cout &lt;&lt; &quot;Bitte geben sie das Passwort ein:\n&quot;;
    cout &lt;&lt; &quot;\n&quot;;

    char test3[64];

    cin.getline (test3,64);

    char password3[r];

    for (int a1=0; a1&lt;r; a1++)
    {
            password3[a1] = test3[a1];
        }

    cout &lt;&lt; &quot;\n&quot;;

    for (int h1 = 0; h1 &lt; q ; h1++)
    {
        if (isalpha(phrase[h1]))
        {
            phrase[h1] = (phrase[h1] - (password3[h1]%26));
            }
        } 

    cout &lt;&lt; phrase;

    cin.get();
    return 0;
}
</code></pre>
<p>[/code]</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/294413/probleme-beim-erstellen-von-vigenère-cipher</link><generator>RSS for Node</generator><lastBuildDate>Sat, 15 Aug 2026 20:48:02 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/294413.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 24 Oct 2011 17:49:13 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Probleme beim erstellen von Vigenère Cipher on Mon, 24 Oct 2011 17:49:13 GMT]]></title><description><![CDATA[<p>Hallo, bin dabei ein Programm zu entwickeln, dass mir eine Eingabe nach<br />
Vigenère Cipher chiffriert, diese ausgibt und wenn man dann wieder das richtige Passwort eingibt, wieder richtig dechiffriert.<br />
Ich bin eigentlich so ziemlich fertig mit dem Programm, jedoch stimmt wahrscheinlich mein chiffriercode nicht, kann mir da vielleicht jemand helfen, ich blicke nicht mehr durch. Nach meiner Ansicht sollte alles stimmen.</p>
<p><a href="http://en.wikipedia.org/wiki/Vigen%C3%A8re_cipher" rel="nofollow">http://en.wikipedia.org/wiki/Vigenère_cipher</a></p>
<pre><code class="language-cpp">[code]
#include &lt;iostream&gt;
#include &lt;cmath&gt;
#include &lt;climits&gt;
#include &lt;cstring&gt;

using namespace std;

//*****************************************************************************
//Dieses Register führt eine TestArray ein, um länge anzupassen.
//*****************************************************************************

int main()
{
    char test[256]; //dient zur stringkuerzung
    cout &lt;&lt; &quot;Geben sie einen zu kodierenden Satz ein:\n&quot;;
    cout &lt;&lt; &quot;\n&quot;;
    cin.getline (test,256);

    int q = (strlen(test));

    char phrase[q];

    for (int x=0; x&lt;q; x++)
    {
           phrase[x] = test[x];
        }  

    char test2[64]; //dient zur stringkuerzung
    cout &lt;&lt; &quot;\n&quot;;
    cout &lt;&lt; &quot;Geben sie ein Passwort ein:\n&quot;;
    cout &lt;&lt; &quot;\n&quot;;

    cin.getline (test2,64);

    int r = (strlen(test2));

    char password[r];
    char password2[q];

    for (int y=0; y&lt;r; y++)
    {
            password[y] = test2[y];
        }    

//*****************************************************************************
//Dieses Register enthält die Umrechnung.
//*****************************************************************************

    for (int i = 0; i &lt; q ; i++)
    {
        if (isalpha(phrase[i]))
        {
            phrase[i] =  (phrase[i] - 32);
            }
        else
        {
            ;
        }
        }

    for (int j = 0; j &lt; r ; j++)
    {
        if (isalpha(password[j]))
        {
            password[j] = password[j] - 32;
            }
        else
        {
            ;
        }
        }

//*****************************************************************************
//Dieses Register enthaelt die Streckung des Passwortes auf die Länge von phrase
//*****************************************************************************

    if (q&lt;=r)
    {
            for (int s =0; s&lt;q; s++)
            {        password2[s] = password[s];
                     }
            }

    if (r&lt;q)
    {
            int t = 0;
            int w = r;
            for ( ; w&lt;q ; )
            {
                if (t&lt;r)
                {   for ( ; t&lt;r; t++)
                    {        password2[t] = password[t];
                             }
                    }

                t= r+1;

                if (t&gt;r)
                {
                    int l =0;
                    for ( ; l&lt;r &amp;&amp; w&lt;q ;l++)
                    {
                             password2[w] = password[l];
                             w++;
                             } 
                    l=0;
                    } 
            }
    } 

    cout &lt;&lt; &quot;\n&quot;;     

//*****************************************************************************
//Dieses Register enthaelt die Funktion.
//*****************************************************************************

    for (int h = 0; h &lt; q ; h++)
    {
        if (isalpha(phrase[h]))
        {
            phrase[h] = (phrase[h] + (password[h]%26));
            }
        } 

    cout &lt;&lt; phrase;    

    cout &lt;&lt; &quot;\n&quot;;

//*****************************************************************************
//Dieses Register enthaelt Die Rückfunktion
//*****************************************************************************        

    cout &lt;&lt; &quot;\n&quot;;
    cout &lt;&lt; &quot;Bitte geben sie das Passwort ein:\n&quot;;
    cout &lt;&lt; &quot;\n&quot;;

    char test3[64];

    cin.getline (test3,64);

    char password3[r];

    for (int a1=0; a1&lt;r; a1++)
    {
            password3[a1] = test3[a1];
        }

    cout &lt;&lt; &quot;\n&quot;;

    for (int h1 = 0; h1 &lt; q ; h1++)
    {
        if (isalpha(phrase[h1]))
        {
            phrase[h1] = (phrase[h1] - (password3[h1]%26));
            }
        } 

    cout &lt;&lt; phrase;

    cin.get();
    return 0;
}
</code></pre>
<p>[/code]</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2135273</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2135273</guid><dc:creator><![CDATA[tschabos]]></dc:creator><pubDate>Mon, 24 Oct 2011 17:49:13 GMT</pubDate></item><item><title><![CDATA[Reply to Probleme beim erstellen von Vigenère Cipher on Mon, 24 Oct 2011 17:55:08 GMT]]></title><description><![CDATA[<p>Hast du ein konkretes Problem? Eine konkrete Frage? Nur weil du glaubst, dass du vielleicht ein nicht näher beschriebenes Problem haben könntest, liest sich doch niemand 160 Zeilen Code durch.</p>
<p>edit: Einen kenne ich, der so viel Zeit hat: Meinen Compiler. Und der meint dazu:</p>
<pre><code>[b]$&gt;[/b] g++ test.cc -Wall -Wextra -Weffc++ -pedantic 
test.cc: In function ‘int main()’:
test.cc:21: warning: ISO C++ forbids variable length array ‘phrase’
test.cc:37: warning: ISO C++ forbids variable length array ‘password’
test.cc:38: warning: ISO C++ forbids variable length array ‘password2’
test.cc:141: warning: ISO C++ forbids variable length array ‘password3’
</code></pre>
<p>Benutze er doch std::strings statt char-Arrays!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2135276</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2135276</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Mon, 24 Oct 2011 17:55:08 GMT</pubDate></item><item><title><![CDATA[Reply to Probleme beim erstellen von Vigenère Cipher on Mon, 24 Oct 2011 17:58:38 GMT]]></title><description><![CDATA[<p>Hallo, das konkrete Problem liegt bei der Codeumwandlung, der Code wird falsch umgewandelt, sprich die Umwandlung in zeile 122 und 155 stimmt wahrscheinlich nicht. Ich weiss aber nicht was ich dort anderes machen könnte?</p>
<p>Die Aufgabe besteht leider darin, dies mit chars zu tun.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2135277</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2135277</guid><dc:creator><![CDATA[tschabos]]></dc:creator><pubDate>Mon, 24 Oct 2011 17:58:38 GMT</pubDate></item><item><title><![CDATA[Reply to Probleme beim erstellen von Vigenère Cipher on Mon, 24 Oct 2011 18:29:43 GMT]]></title><description><![CDATA[<p>tschabos schrieb:</p>
<blockquote>
<p>Die Aufgabe besteht leider darin, dies mit chars zu tun.</p>
</blockquote>
<p>Dann ist es trotzdem falsch.</p>
<p>Was mir auch auffällt sind sehr viele magische Werte wie 32 oder 26. Ja, ich kann mir erschließen, was damit wohl gemeint ist, weil ich selber mal programmiert habe. Trotzdem sieht das falsch aus und ist es höchstwahrscheinlich auch.</p>
<p>Außerdem hast du sehr viele Variablen mit nichtssagenden Namen. Bist du sicher, dass du auch immer an jeder Stelle den Wert genommen hast, den du auch gemeint hast?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2135295</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2135295</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Mon, 24 Oct 2011 18:29:43 GMT</pubDate></item><item><title><![CDATA[Reply to Probleme beim erstellen von Vigenère Cipher on Thu, 27 Oct 2011 15:17:20 GMT]]></title><description><![CDATA[<p>So, ich habe es nun einmal mit strings versucht, das Programm gibt mir eigentlich schon fast wieder den richtigen Satz heraus, wenn ich ihn mit dem richtigen passwort dechiffriere. Das Problem ist aber, dass manchmal trotzdem irgendwie komische Zeichen vorkommen, ich blicke einfach nicht mehr durch.</p>
<pre><code class="language-cpp">[code]
#include &lt;iostream&gt;
#include &lt;cmath&gt;
#include &lt;climits&gt;
#include &lt;cstring&gt;

using namespace std;

//*****************************************************************************
//Dieses Register führt eine TestArray ein, um länge anzupassen.
//*****************************************************************************

int main()
{
    string phrase; //dient zur stringkuerzung
    cout &lt;&lt; &quot;Geben sie einen zu kodierenden Satz ein:\n&quot;;
    cout &lt;&lt; &quot;\n&quot;;
    getline (cin,phrase);

    int q = phrase.length();     

    string password; //dient zur stringkuerzung
    cout &lt;&lt; &quot;\n&quot;;
    cout &lt;&lt; &quot;Geben sie ein Passwort ein:\n&quot;;
    cout &lt;&lt; &quot;\n&quot;;

    getline (cin,password);

    int r = password.length();  

    string password2;

    for (int passwordzurueck = 0; passwordzurueck &lt; q ;passwordzurueck++)
    {
        password2[passwordzurueck] = 0; 
        }

//*****************************************************************************
//Dieses Register enthält die Umrechnung.
//*****************************************************************************

    for (int i = 0; i &lt; q ; i++)
    {
        if (isalpha(phrase[i]))
        {
            phrase[i] =  (phrase[i] - 32);
            }
        else
        {
            ;
        }
        }

    for (int j = 0; j &lt; r ; j++)
    {
        if (isalpha(password[j]))
        {
            password[j] = password[j] - 32;
            }
        else
        {
            ;
        }
        }

//*****************************************************************************
//Dieses Register enthaelt die Streckung des Passwortes auf die Länge von phrase
//*****************************************************************************

    if (q&lt;=r)
    {
            for (int s =0; s&lt;q; s++)
            {        password2[s] = password[s];
                     }
            }

    if (r&lt;q)
    {
            for (int t = 0; t&lt;q ;)
            {
                     for(int t1 = 0 ; t1&lt;r &amp;&amp; t&lt;q ;)
                     {
                            password2 = password2 + password[t1];
                     t++;
                     t1++;
                     }
                     }
            }          

    cout &lt;&lt; &quot;\n&quot;;     

//*****************************************************************************
//Dieses Register enthaelt die Funktion.
//*****************************************************************************

    for (int h = 0; h &lt; q ; h++)
    {  
        if (isalpha(phrase[h]))
        {
            phrase[h] = ((phrase[h]-65) + ((password2[h]-65)%26))+65;
            }
        else
        {
            ;
            }
        } 

    cout &lt;&lt; phrase;    

    cout &lt;&lt; &quot;\n&quot;;

//*****************************************************************************
//Dieses Register enthaelt die Streckung des Passwortes auf die Länge von phrase
//*****************************************************************************        

    cout &lt;&lt; &quot;\n&quot;;
    cout &lt;&lt; &quot;Bitte geben sie das Passwort ein:\n&quot;;
    cout &lt;&lt; &quot;\n&quot;;

    string password3;
    getline (cin,password3);

    if (q&lt;=r)
    {
            for (int s =0; s&lt;q; s++)
            {        password3[s] = password[s];
                     }
            }

    if (r&lt;q)
    {
            for (int t = 0; t&lt;q ;)
            {
                     for(int t1 = 0 ; t1&lt;r &amp;&amp; t&lt;q ;)
                     {
                            password3 = password3 + password[t1];
                     t++;
                     t1++;
                     }
                     }
            }             

    cout &lt;&lt; &quot;\n&quot;;

//*****************************************************************************
//Dieses Register enthaelt die Rueckfunktion
//*****************************************************************************

    for (int h1 = 0; h1 &lt; q ; h1++)
    {
        if (isalpha(phrase[h1]))
        {
            phrase[h1] = ((phrase[h1]-65) - ((password3[h1]-65)%26))+65;
            }
        else
        {
            ;
            }
        } 

    cout &lt;&lt; phrase;

    cin.get();
    return 0;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2136709</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2136709</guid><dc:creator><![CDATA[tschabos]]></dc:creator><pubDate>Thu, 27 Oct 2011 15:17:20 GMT</pubDate></item></channel></rss>