Exemple #1
0
        public static void Menu1_CreateNet()
        {
            int SL = 0;

            while (!((SL <= 8) && (SL >= 4)))
            {
                Console.WriteLine("Enter S-box length [4-8]: ");
                SL = Convert.ToInt32(Console.ReadLine());
            }
            int WL = 1;

            while (!((WL / SL == WL / (double)SL) && (WL <= 64)))
            {
                Console.WriteLine("Enter whole word length which must be divisible by S-box length: ");
                WL = Convert.ToInt32(Console.ReadLine());
            }
            if (SBDB == null)
            {
                SBDB = E.GetSBlockDBInstance();
            }
            var Settings = new Allax.SPNetSettings((byte)WL, (byte)SL, SBDB);

            Net = E.GetSPNetInstance(Settings);
            AddFullRound(Net);
            AddLastRound(Net);
        }
 public virtual ISPNet GetSPNetInstance(SPNetSettings settings) //from interfaces
 {
     if (settings.db == null)
     {
         TheDB = new SBlockDB();
     }
     TheNet = new SPNet(settings);
     return(TheNet);
 }
 public SPNet(SPNetSettings settings)
 {
     _settings = settings;
     Layers    = new List <Layer>();
 }