Ejemplo n.º 1
0
        private void CreateKey()
        {
            byte[]   key      = new byte[strKey.Length / 8];
            string[] keyParts = new string[strKey.Length / 8];
            int      count    = 0;

            for (int i = 0; i < strKey.Length; i++)
            {
                if ((i % 8 == 0) && (i != 0))
                {
                    count++;
                }

                keyParts[count] += strKey[i];
            }

            for (int i = 0; i < key.Length; i++)
            {
                key[i] = Convert.ToByte(keyParts[i], 2);
            }

            FileWork fw = new FileWork();

            fw.WriteToFile(fileName, key);
            MessageBox.Show("Ключ создан!");

            this.Close();
        }
Ejemplo n.º 2
0
        private void fileSaveButton_Click(object sender, EventArgs e)
        {
            FileWork fw = new FileWork();

            saveFileDialog1.ShowDialog();
            string file = saveFileDialog1.FileName;

            fw.WriteToFile(file, encrByteFile);
        }