Beispiel #1
0
        private void btnStartPrecomputation_Click(object sender, EventArgs e)
        {
            DialogResult dr = MessageBox.Show("Do you want to save the result into a file?", this.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            FolderBrowserDialog fbd = new FolderBrowserDialog();
            ThreadDataContainer tdc = new ThreadDataContainer();

            if (dr == System.Windows.Forms.DialogResult.Yes)
            {
                fbd.Description = "Please select a folder to save the generated Hellman Table";
                if (fbd.ShowDialog() == System.Windows.Forms.DialogResult.Cancel)
                {
                    return;
                }

                tdc.SaveToFile = true;
                tdc.FilePath   = fbd.SelectedPath;
                UpdateLogWithDate("Selected Folder: " + fbd.SelectedPath);
            }
            else
            {
                tdc.SaveToFile = false;
                tdc.FilePath   = "";
            }

            tdc.m = uint.Parse(txtM.Text.Trim());
            tdc.t = uint.Parse(txtT.Text.Trim());
            tdc.numberOfTables = uint.Parse(txtNumberOfTables.Text.Trim());
            UpdateLogWithDate("Starting a new thread.");
            Thread Th1 = new Thread(new ParameterizedThreadStart(ThreadedPrecomputation));

            Th1.Start(tdc);
            UpdateLogWithDate("New thread started with Thread ID " + Th1.ManagedThreadId.ToString());
        }
Beispiel #2
0
        void ThreadedPrecomputation(object o)
        {
            ThreadDataContainer tdc = o as ThreadDataContainer;

            //int zaman = Environment.TickCount;
            hll = new HellmanTables(tdc.m, tdc.t, tdc.numberOfTables);
            hll.TableProcessed += new HellmanTables.TableProcessedEventHandler(hll_TableProcessed);
            UpdateLogWithDate("Starting to generate Hellman Tables.");
            hll.GenerateTables();
            UpdateLogWithDate("Hellman Tables have been generated.");
            //zaman = Environment.TickCount - zaman;
            if (tdc.SaveToFile)
            {
                string yol = Path.Combine(tdc.FilePath, "Tables_" + hll.m + "-" + hll.t + "-" + hll.numberOfTables + ".bin");
                hll.SaveTablesToFile(yol);
                UpdateLogWithDate("Table Data has been written to the file: " + yol);
            }
            //MessageBox.Show(zaman.ToString() + " milisaniyede oldu bu iş...");
            UpdateLogWithDate("Now you can use 'Hash Finder' section.");
            grbHashFind.Enabled = true;
        }
Beispiel #3
0
        private void btnStartPrecomputation_Click(object sender, EventArgs e)
        {
            DialogResult dr = MessageBox.Show("Do you want to save the result into a file?", this.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            FolderBrowserDialog fbd = new FolderBrowserDialog();
            ThreadDataContainer tdc = new ThreadDataContainer();

            if (dr == System.Windows.Forms.DialogResult.Yes)
            {
                fbd.Description = "Please select a folder to save the generated Hellman Table";
                if (fbd.ShowDialog() == System.Windows.Forms.DialogResult.Cancel)
                    return;

                tdc.SaveToFile = true;
                tdc.FilePath = fbd.SelectedPath;
                UpdateLogWithDate("Selected Folder: " + fbd.SelectedPath);
            }
            else
            {
                tdc.SaveToFile = false;
                tdc.FilePath = "";
            }

            tdc.m = uint.Parse(txtM.Text.Trim());
            tdc.t = uint.Parse(txtT.Text.Trim());
            tdc.numberOfTables = uint.Parse(txtNumberOfTables.Text.Trim());
            UpdateLogWithDate("Starting a new thread.");
            Thread Th1 = new Thread(new ParameterizedThreadStart(ThreadedPrecomputation));
            Th1.Start(tdc);
            UpdateLogWithDate("New thread started with Thread ID " + Th1.ManagedThreadId.ToString());
        }