private bool CheckAandB() { if (this.gen_textbox_a.value_textbox.Text == "" || this.gen_textbox_a.value_textbox.Text == "-") { this.warn_text_a.Text = "Поле не может быть пустым"; this.warn_text_a.Visibility = Visibility.Visible; return(false); } if (this.gen_textbox_b.value_textbox.Text == "" || this.gen_textbox_b.value_textbox.Text == "-") { this.warn_text_b.Text = "Поле не может быть пустым"; this.warn_text_b.Visibility = Visibility.Visible; return(false); } BigInteger p = BigInteger.Parse(this.gen_textbox_p.value_textbox.Text); BigInteger a = BigInteger.Parse(this.gen_textbox_a.value_textbox.Text); BigInteger b = BigInteger.Parse(this.gen_textbox_b.value_textbox.Text); if (!CurveCondition.SingularCondition(a, b, p)) { this.warn_text_a.Text = "Дискриминант равен нулю"; this.warn_text_a.Visibility = Visibility.Visible; this.warn_text_b.Text = "Дискриминант равен нулю"; this.warn_text_b.Visibility = Visibility.Visible; return(false); } return(true); }
private void ConditionsN() { BigInteger p = BigInteger.Parse(this.gen_textbox_p.value_textbox.Text); BigInteger n = BigInteger.Parse(this.schoof_value.Text); if (!CurveCondition.MOVCondition(20, p, n)) { this.warn_text_n.Text = "Не выполняются требования МОВ"; this.warn_text_n.Visibility = Visibility.Visible; } if (!CurveCondition.AnomalousCondition(p, n)) { this.warn_text_n.Text = "Аномальная кривая"; this.warn_text_n.Visibility = Visibility.Visible; } }
public void SchemeGrade(Scheme s) { BigInteger p = BigInteger.Parse(s.P); BigInteger a = BigInteger.Parse(s.A); BigInteger b = BigInteger.Parse(s.B); BigInteger n = BigInteger.Parse(s.N); Brush yellow = new SolidColorBrush(Color.FromArgb(255, 228, 149, 54)); this.select_scheme_textblock.Text = s.Name; if (!CurveCondition.SingularCondition(a, b, p)) { this.report_singular.Text = "Сингулярная кривая"; this.report_singular.Foreground = Brushes.Red; } else { this.report_singular.Text = "Не сингулярная кривая"; this.report_singular.Foreground = Brushes.Green; } if (!CurveCondition.AnomalousCondition(p, n)) { this.report_anomal.Text = "Аномальная кривая"; this.report_anomal.Foreground = Brushes.Red; } else { this.report_anomal.Text = "Не аномальная кривая"; this.report_anomal.Foreground = Brushes.Green; } if (!CurveCondition.MOVCondition(20, p, n)) { this.report_mov.Text = "Подвержена MOV атакам"; this.report_mov.Foreground = yellow; } else { this.report_mov.Text = "Не подвержена MOV атакам"; this.report_mov.Foreground = Brushes.Green; } if (!CurveCondition.NLengthCondition(p, n)) { this.report_nlenght.Text = "Неприемлемый кофактор"; this.report_nlenght.Foreground = Brushes.Red; } else { this.report_nlenght.Text = "Допустимый кофактор"; this.report_nlenght.Foreground = Brushes.Green; } int prot = CurveCondition.ProtectionLevel(n); if (prot <= 16) { this.report_protect.Text = "Слабая защита"; this.report_protect.Foreground = Brushes.Red; } else if (prot <= 29) { this.report_protect.Text = "Средняя защита"; this.report_protect.Foreground = yellow; } else if (prot <= 39) { this.report_protect.Text = "Сильная защита"; this.report_protect.Foreground = Brushes.Green; } }