Exemple #1
0
//-------------------------------------------------------------------------------------------------------

        public static string dekoduj(char znak, string wejTextRaw)         // główna funkcja dekodująca!!!
        {
            string matrycaTemp = "";
            string textWyj     = "";
            string wejText;
            int    klucz = 0;

            wejText = znajdzKlucz(ref klucz, znak, wejTextRaw);

            matrycaTemp = MsgCrypt.zworcKod(klucz);

            for (int i = 0; i < wejText.Length; i++)
            {
                for (int j = 0; j < matrycaTemp.Length; j++)
                {
                    if (wejText[i] == matrycaTemp[j])
                    {
                        textWyj += matryca[j];
                        continue;
                    }
                }
            }

            return(textWyj);
        }
Exemple #2
0
//   #############################################################################################################################
//   -----------------------------------------------------------------------------------------------------------------------------
        void SzyfrujClick(object sender, EventArgs e)
        {
            int nrTab = losuj.Next(0, 31);

            if (richTextBox1.Text != "")
            {
                richTextBox2.Text = start.koduj(nrTab.ToString(), MsgCrypt.zworcKod(nrTab), richTextBox1.Text);
                szyfruj.Enabled   = false;
            }
            else
            {
                MessageBox.Show("Brak danych do zakodowania!", "Coding Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }