private void btnBrowseFile_Click(object sender, EventArgs e) { OpenFileDialog ofd = new OpenFileDialog(); ofd.Filter = "BIN Files|*.bin|All Files|*.*"; ofd.InitialDirectory = Application.StartupPath; if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.Cancel) { return; } UpdateLogWithDate("Starting to parse file name to find parameters."); string dosya = Path.GetFileName(ofd.FileName); string[] mtn = dosya.Split('_', '.')[1].Split('-'); uint m = uint.Parse(mtn[0].Trim()); uint t = uint.Parse(mtn[1].Trim()); uint numberOfTables = uint.Parse(mtn[2].Trim()); DialogResult dr = MessageBox.Show("Recognized values are:\r\nm = " + m + "\r\nt = " + t + "\r\nNumber of Tables = " + numberOfTables + "\r\nConfirm?", this.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dr == System.Windows.Forms.DialogResult.No) { return; } UpdateLogWithDate("Generating Hellman Tables."); hll = new HellmanTables(m, t, numberOfTables); hll.ReadTablesFromFile(ofd.FileName); UpdateLogWithDate("Hellman Tables has been read from the file."); UpdateLogWithDate("Now you can use 'Hash Finder' section."); grbHashFind.Enabled = true; }
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; }