示例#1
0
        private void b_DeCript_Click(object sender, EventArgs e)
        {
            if (KeyGenerator.generetKeys(t_passwordWord.Text) != 0)
            {
                return;
            }

            ulong[] criptBlocks;
            ulong[] deCriptBlocks;

            criptBlocks = WorkWithString.convert16strToBlocks(t_ToEncr.Text);

            if (criptBlocks == null)
            {
                t_DeCript.Text = "";
                return;
            }


            deCriptBlocks = new ulong[criptBlocks.Length];

            DES.TripleDesDecode(criptBlocks, out deCriptBlocks);

            t_DeCript.Text = WorkWithString.convertBlocksToStr(deCriptBlocks);
        }
示例#2
0
        private void b_DeCript_Click(object sender, EventArgs e)
        {
            if (KeyGenerator.generetKeys(t_passwordWord.Text) != 0)
            {
                return;
            }

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

            String[] deCriptoText = new String[1];
            String   allStr       = "";

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

            criptBlock = WorkWithString.convert16strToBlocks(allStr);

            if (criptBlock == null)
            {
                return;
            }

            DES.TripleDesDecode(criptBlock, out deCriptBlock);
            deCriptoText[0] = WorkWithString.convertBlocksToStr(deCriptBlock);
            try
            {
                File.WriteAllLines(t_ReturnFile.Text, deCriptoText);
            }
            catch
            {
                MessageBox.Show("Имя файла результатов указано не верно.");
                return;
            }
        }