Beispiel #1
0
        private void b_Encr_Click(object sender, EventArgs e)
        {
            if (!KeyGenerator.isConfirmation(t_passwordWord.Text))
            {
                return;
            }

            if (KeyGenerator.generetKeys(t_passwordWord.Text) != 0)
            {
                return;
            }

            ulong [] sourseBlock;
            ulong [] criptBlock;
            string[] readText;

            try
            {
                readText = File.ReadAllLines(t_SourseFile.Text);
            }
            catch
            {
                MessageBox.Show("Имя исходного файла указано не верно.");
                return;
            }

            String allStr = "";

            for (int i = 0; i < readText.Length; i++)
            {
                allStr += readText[i];
                allStr += Environment.NewLine;
            }

            String[] criptoText16 = new String[1];
            WorkWithString.convertStrToBlocks(allStr, out sourseBlock);

            if (sourseBlock == null)
            {
                return;
            }

            DES.TripleDesIncode(sourseBlock, out criptBlock);
            criptoText16[0] = WorkWithString.convertBlocksTo16str(criptBlock);

            try
            {
                File.WriteAllLines(t_ReturnFile.Text, criptoText16);
            }
            catch
            {
                MessageBox.Show("Имя файла результатов указано не верно.");
            }
        }
Beispiel #2
0
        private void b_Encr_Click(object sender, EventArgs e)
        {
            if (!KeyGenerator.isConfirmation(t_passwordWord.Text))
            {
                return;
            }

            if (KeyGenerator.generetKeys(t_passwordWord.Text) != 0)
            {
                return;
            }

            ulong[] notCriptBlocks;
            ulong[] criptBlocks;

            WorkWithString.convertStrToBlocks(t_ToEncr.Text, out notCriptBlocks);

            criptBlocks = new ulong[notCriptBlocks.Length];

            DES.TripleDesIncode(notCriptBlocks, out criptBlocks);

            t_DeCript.Text = WorkWithString.convertBlocksTo16str(criptBlocks);
        }