public void DicBrute_Start(string pass) { Thread thread = new Thread(() => { using (StreamReader sr = new StreamReader(Filename)) { DateTime dts = DateTime.Now; work = true; double count = 0; while (work) { curr_value = Convert(sr.ReadLine()); count++; if (curr_value == pass || curr_value == null) { work = false; } TimeSpan totaltime = DateTime.Now.Subtract(dts); double speed = count / totaltime.TotalSeconds; OnNewPassWasFound?.Invoke(curr_value, speed, totaltime); } } }); thread.Priority = ThreadPriority.Lowest; thread.Start(); }
public void FullBrute_Start(string pass) { Thread thread = new Thread(() => { DateTime dts = DateTime.Now; work = true; FullBrute_SetUp(); double count = 0; foreach (var p in GetCombinations(alph.ToCharArray(), MaxLength)) { if (!work) { break; } curr_value = p; count++; if (curr_value == pass) { work = false; break; } TimeSpan totaltime = DateTime.Now.Subtract(dts); double speed = count / totaltime.TotalSeconds; OnNewPassWasFound?.Invoke(curr_value, speed, totaltime); } }); thread.Priority = ThreadPriority.Lowest; thread.Start(); }