void GetTab2Ready() { // Finite Field F3 = new FiniteField(3); // LFSR 1 - 3 string strf1 = "201", stri1 = "001"; Polynomial feedback1 = Polynomial.Parse(F3, strf1, false); Polynomial initial1 = Polynomial.Parse(F3, stri1, false); L1 = new LFSR(feedback1, initial1.Coefficients); Tab2lblLFSR1.Text += "\r\n" + "Feedback: " + Polynomial.Parse(F3, "1" + strf1, false).ToString() + "\r\nInitial: " + stri1 + "\r\nPeriod = " + L1.Period; // LFSR 2 - 4 string strf2 = "2001", stri2 = "0001"; Polynomial feedback2 = Polynomial.Parse(F3, strf2, false); Polynomial initial2 = Polynomial.Parse(F3, stri2, false); L2 = new LFSR(feedback2, initial2.Coefficients); Tab2lblLFSR2.Text += "\r\n" + "Feedback: " + Polynomial.Parse(F3, "2" + strf2, false).ToString() + "\r\nInitial: " + stri2 + "\r\nPeriod = " + L2.Period; // LFSR 3 - 5 string strf3 = "20001", stri3 = "00001"; Polynomial feedback3 = Polynomial.Parse(F3, strf3, false); Polynomial initial3 = Polynomial.Parse(F3, stri3, false); L3 = new LFSR(feedback3, initial3.Coefficients); Tab2lblLFSR3.Text += "\r\n" + "Feedback: " + Polynomial.Parse(F3, "1" + strf3, false).ToString() + "\r\nInitial: " + stri3 + "\r\nPeriod = " + L3.Period; // LFSR 4 - 7 string strf4 = "0000201", stri4 = "1012220"; Polynomial feedback4 = Polynomial.Parse(F3, strf4, false); Polynomial initial4 = Polynomial.Parse(F3, stri4, false); L4 = new LFSR(feedback4, initial4.Coefficients); Tab2lblLFSR4.Text += "\r\n" + "Feedback: " + Polynomial.Parse(F3, "1" + strf4, false).ToString() + "\r\nInitial: " + stri4 + "\r\nPeriod = 26 (precomputed)";// +L4.Period; // Nonlinear Combiner NonlinCombOutput = ""; Tab2lblNonLinComb.Text += "\r\n(X1+X3) * (X2+X4)"; }
private void btnFixValues_Click(object sender, EventArgs e) { if (btnFixField.Enabled) { MessageBox.Show("First fix the field!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } string poly = "1" + string.Join("", txtFeedback.Text.Reverse()); Polynomial feedback = Polynomial.Parse(F, txtFeedback.Text,false); lblFeedback.Text = "Feedback Polynomial: " + Polynomial.Parse(F, poly,false).ToString(); Polynomial initial = Polynomial.Parse(F, txtInitial.Text.Trim(),false); lblInitial.Text = "Initial State: " + initial.ToString(); lfsr = new LFSR(feedback, initial.Coefficients); txtOutput.Text = ""; // txtInitial.Text.Trim(); lblSeqSize.Text = "Ready"; btnGenSeq.Enabled = true; btnFindPeriod.Enabled = true; btnFixValues.Enabled = false; }