예제 #1
0
 private void Gen_textbox_p_GenButtonClick(object sender, RoutedEventArgs e)
 {
     if (gen_textbox_p.down_textbox.Text != "" && gen_textbox_p.down_textbox.Text != "0" && gen_textbox_p.down_textbox.Text != "1")
     {
         int        bits    = Convert.ToInt32(gen_textbox_p.down_textbox.Text);
         BigInteger prime_p = Maths.genPseudoPrime(bits, new Random());
         gen_textbox_p.value_textbox.Text = prime_p.ToString();
     }
 }
예제 #2
0
        private void BeginRandomGeneration()
        {
            int        bits = Convert.ToInt32(this.complexity_rand_scheme.Text);
            Random     rnd  = new Random();
            BigInteger p    = Maths.genPseudoPrime(bits, rnd);

            gen_textbox_p.value_textbox.Text = p.ToString();
            BigInteger a = Maths.RandBigInteger(bits, rnd);

            gen_textbox_a.value_textbox.Text = a.ToString();
            BigInteger b = Maths.RandBigInteger(bits, rnd);

            gen_textbox_b.value_textbox.Text = b.ToString();
            bw   = new BackgroundWorker();
            algo = new Schoof(1, a, b, p, bw);
            bw.WorkerSupportsCancellation = true;
            bw.DoWork             += new DoWorkEventHandler(Bw_DoWork);
            bw.RunWorkerCompleted += new RunWorkerCompletedEventHandler(Bw_RunWorkerCompletedRand);
            this.schoof_stop_button.Visibility = Visibility.Visible;
            this.schoof_value.Text             = "";
            bw.RunWorkerAsync();
        }