Esempio n. 1
0
        private void btnSBox_Click(object sender, EventArgs e)
        {
            ParseWandO();

            Serpent.ApplySerpentSBox(ref W[0], ref W[1], ref W[2], ref W[3], (int)nupSbox.Value);

            FillO(W);
        }
Esempio n. 2
0
        private void btn05to3_Click(object sender, EventArgs e)
        {
            ParseWandO();

            Serpent.ApplySerpentPermutation(ref W[0], ref W[1], ref W[2], ref W[3]);

            Serpent.ApplySerpentSBox(ref W[0], ref W[1], ref W[2], ref W[3], 1);
            Serpent.ApplySerpentPermutation(ref W[0], ref W[1], ref W[2], ref W[3]);

            Serpent.ApplySerpentSBox(ref W[0], ref W[1], ref W[2], ref W[3], 2);
            Serpent.ApplySerpentPermutation(ref W[0], ref W[1], ref W[2], ref W[3]);

            FillO(W);
        }
Esempio n. 3
0
        private void btnAutoOpStart_Click(object sender, EventArgs e)
        {
            try
            {
                ParseWandO();

                for (int i = 0; i < lstAutoOpList.Items.Count; i++)
                {
                    string s = lstAutoOpList.Items[i].ToString();
                    if (s.Contains(" - "))
                    {
                        // S-Box
                        int rnd = int.Parse(s.Split(new string[] { " - " }, StringSplitOptions.None)[1]);

                        if (s.Contains("Inverse"))
                        {
                            // Inverse
                            Serpent.ApplySerpentInvSBox(ref W[0], ref W[1], ref W[2], ref W[3], rnd);
                        }
                        else
                        {
                            // Normal
                            Serpent.ApplySerpentSBox(ref W[0], ref W[1], ref W[2], ref W[3], rnd);
                        }
                    }
                    else
                    {
                        // Permutation
                        if (s.Contains("Inverse"))
                        {
                            // Inverse
                            Serpent.ApplySerpentInvPermutation(ref W[0], ref W[1], ref W[2], ref W[3]);
                        }
                        else
                        {
                            // Normal
                            Serpent.ApplySerpentPermutation(ref W[0], ref W[1], ref W[2], ref W[3]);
                        }
                    }
                }

                FillO(W);
            }
            catch
            {
                MessageBox.Show("There was an error!");
            }
        }