Ejemplo n.º 1
0
        private void b_sEncrypt_Click(object sender, EventArgs e)
        {
            DialogResult dialog = saveFileDialog1.ShowDialog();

            if (dialog == DialogResult.OK)
            {
                output = saveFileDialog1.FileName;
                using (Stream mystream = File.Open(output, FileMode.Create))

                {
                    Cypherer cp = new Cypherer(t_passPhase.Text);
                    cp.letsEncrypt(mystream, richTextBox1.Text);

                    mystream.Close();
                }
            }
        }
Ejemplo n.º 2
0
        private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
        {
            found = false;

            if (wordList.Count() == 0)
            {
                MessageBox.Show("No dictionary chosen");
            }
            else if (input == null)
            {
                MessageBox.Show("No target file found");
            }
            else
            {
                Parallel.ForEach(wordList, (word, state) =>
                {
                    if (found != true)
                    {
                        lock (syncLock) { Stream instream = File.Open(input, FileMode.Open);
                                          Cypherer cp     = new Cypherer(word);
                                          String text;
                                          text = cp.letsDecrypt(instream);
                                          if (text != "-1")
                                          {
                                              result = text;
                                              found  = true;
                                          }
                                          instream.Close(); }
                    }
                    else
                    {
                        state.Break();
                    }
                });

                if (found != true)
                {
                    result = "Nothing Found";
                }
            }
        }