public void Init(TaskerParams Params) { this.Params = Params; _rounds_count = Params.Net.GetLayers().Count / 3; _tempEmptyWay = WayConverter.ToWay(Params.Net); IsBruteForceTurnedOn = false; Iter = new InputsIterator(Params.Net.GetSettings().SBoxCount, Params.Net.GetSettings().SBoxSize); _tasks = new ConcurrentQueue <Task>(); InitSolvers(); ProcessRules(); }
void ProcessRules() { //throw new NotImplementedException(); for (int i = 0; i < Params.Alg.Rules.Count; i++) { var Rule = Params.Alg.Rules[i]; if (Rule.UseCustomInput == true) { var SolParam = new SolverParams(WayConverter.ToWay(Params.Net, Rule.Input), Params.Net, Params.Alg.Type, Rule.MaxActiveBlocksOnLayer); var T = new Task(Solvers[Rule.SolverType].S, SolParam, new ExtraParams()); _tasks.Enqueue(T); } else { var S = Solvers[Rule.SolverType]; S.IsUsedForBruteForce = true; S.MaxActiveBlocksOnLayer = Rule.MaxActiveBlocksOnLayer; Solvers[Rule.SolverType] = S; IsBruteForceTurnedOn = true; } } //Warning! Unoptimized code!!! if (IsBruteForceTurnedOn) { var temp = Iter; SolverInputs NextInput; foreach (var S in Solvers) { if (S.Value.IsUsedForBruteForce) { Iter = new InputsIterator(Params.Net.GetSettings().SBoxCount, Params.Net.GetSettings().SBoxSize); while (!Iter.IsFinished()) { NextInput = Iter.NextState(); var ws = WayConverter.ToWay(Params.Net, NextInput); _tasks.Enqueue(new Task(S.Value.S, new SolverParams(ws, Params.Net, Params.Alg.Type, S.Value.MaxActiveBlocksOnLayer))); } } } Iter = temp; } }