示例#1
0
        private void btnExtPolyMult_Click(object sender, EventArgs e)
        {
            ExtensionFieldElement[] eltlist1 = new ExtensionFieldElement[7];

            for (int i = 0; i < 7; i++)
            {
                eltlist1[i] = ExtF.RandomElement;
            }

            ExtensionPolynomial extp1 = new ExtensionPolynomial(eltlist1);

            ExtensionFieldElement[] eltlist2 = new ExtensionFieldElement[4];

            for (int i = 0; i < 4; i++)
            {
                eltlist2[i] = ExtF.RandomElement;
            }

            ExtensionPolynomial extp2 = new ExtensionPolynomial(eltlist2);

            ExtensionPolynomial result = extp1 * extp2;

            txtInfo.Clear();
            txtInfo.AppendText("Random Extension Polynomial 1\r\n" + extp1.ToString() + "\r\n");
            txtInfo.AppendText("\r\nRandom Extension Polynomial 2\r\n" + extp2.ToString() + "\r\n");
            txtInfo.AppendText("\r\nPolynomial 1 * Polynomial 2\r\n" + result.ToString() + "\r\n");
        }
示例#2
0
        private void btnPrmElt_Click(object sender, EventArgs e)
        {
            ExtensionFieldElement prm = ExtF.RandomPrimitiveElement((new Random()).Next(1, GF56Primitive.Degree));

            txtInfo.Clear();
            txtInfo.AppendText("Random Primitive Element = " + prm.ToString() + "\r\n\r\n");
        }
示例#3
0
        private void btnDivision_Click(object sender, EventArgs e)
        {
            ExtensionFieldElement e1 = ExtF.RandomElement;

            while (e1.Value.IsZero)
            {
                e1 = ExtF.RandomElement;
            }

            ExtensionFieldElement e2 = ExtF.RandomElement;

            while (e2.Value.IsZero)
            {
                e2 = ExtF.RandomElement;
            }

            ExtensionFieldElement q = e1 / e2;

            txtInfo.Clear();
            txtInfo.AppendText("Random Element 1 = " + e1.ToString() + "\r\n");
            txtInfo.AppendText("Random Element 2 = " + e2.ToString() + "\r\n");
            txtInfo.AppendText("Division = " + q.ToString() + "\r\n");
            txtInfo.AppendText("Test E1 = " + ((e2 * q) + (e1 % e2)).ToString() + "\r\n");
            txtInfo.AppendText("\r\n");
        }
示例#4
0
        private void btnNorm_Click(object sender, EventArgs e)
        {
            ExtensionFieldElement elt = ExtF.RandomElement;

            txtInfo.Clear();
            txtInfo.AppendText("Random Element = " + elt.ToString() + "\r\n");
            txtInfo.AppendText("Norm: " + elt.Norm.ToString() + "\r\n");
            txtInfo.AppendText("\r\n");
        }
示例#5
0
        private void btnMultip_Click(object sender, EventArgs e)
        {
            ExtensionFieldElement e1     = ExtF.RandomElement;
            ExtensionFieldElement e2     = ExtF.RandomElement;
            ExtensionFieldElement toplam = e1 * e2;

            txtInfo.Clear();
            txtInfo.AppendText("Random Element 1 = " + e1.ToString() + "\r\n");
            txtInfo.AppendText("Random Element 2 = " + e2.ToString() + "\r\n");
            txtInfo.AppendText("Multiplication = " + toplam.ToString() + "\r\n");
            txtInfo.AppendText("\r\n");
        }
示例#6
0
        private void btnConjugates_Click(object sender, EventArgs e)
        {
            ExtensionFieldElement elt = ExtF.RandomElement;

            txtInfo.Clear();
            txtInfo.AppendText("Random Element = " + elt.ToString() + "\r\n");
            ExtensionFieldElement[] eltConjs = elt.Conjugates;
            txtInfo.AppendText("Conjugates:" + "\r\n");
            for (int i = 0; i < eltConjs.Length; i++)
            {
                txtInfo.AppendText("C(" + (i + 1) + ") = " + eltConjs[i] + "\r\n");
            }
            txtInfo.AppendText("\r\n");
        }
示例#7
0
        private void btnLFSR_Click(object sender, EventArgs e)
        {
            if (lfsr == null)
            {
                ExtensionFieldElement[] eltlist1 = new ExtensionFieldElement[4];

                for (int i = 0; i < 4; i++)
                {
                    eltlist1[i] = ExtF.RandomElement;
                }

                ExtensionPolynomial extp1 = new ExtensionPolynomial(eltlist1);

                ExtensionFieldElement[] eltlist2 = new ExtensionFieldElement[4];

                for (int i = 0; i < 4; i++)
                {
                    eltlist2[i] = ExtF.RandomElement;
                }

                lfsr = new ExtensionLFSR(extp1, eltlist2);

                txtInfo.Clear();
                txtInfo.AppendText("LFSR has been created.\r\n");
                txtInfo.AppendText("Feedback Polynomial:\r\n" + lfsr.FeedbackPolynomial.ToString() + "\r\n");
                txtInfo.AppendText("Initial State:\r\n");
                for (int i = 0; i < lfsr.currentState.Length; i++)
                {
                    txtInfo.AppendText("c_" + i + " = " + lfsr.currentState[i].ToString() + "\r\n");
                }

                btnLFSR.Text = "Clock the LFSR";

                return;
            }

            // clock time

            lfsr.Clock();
            txtInfo.AppendText("\r\nOutput " + s++ + " : " + lfsr.StreamOutput + "\r\n");
            txtInfo.AppendText("Current State:\r\n");
            for (int i = 0; i < lfsr.currentState.Length; i++)
            {
                txtInfo.AppendText("c_" + i + " = " + lfsr.currentState[i].ToString() + "\r\n");
            }
        }