Exemple #1
0
        public Program(string[] args)
        {
            if (args.Length < 2)
            {
                throw new ArgumentException();
            }

            substitutionTable = new SubstitutionTable();
            writer            = Console.Out;
            action            = args[1];

            int version = int.Parse(args[0]);

            switch (version)
            {
            case 1:
                view = new CipherView(writer, new CipherOne(substitutionTable), substitutionTable);
                break;

            case 2:
                view = new CipherView(writer, new CipherTwo(substitutionTable), substitutionTable);
                break;

            default:
                throw new NotImplementedException("Version " + version + " not implemented!");
            }

            arguments = args.Skip(2).ToArray();
        }
 public LinearApproximationTable(SubstitutionTable substitutionTable)
 {
     SBox  = substitutionTable;
     Table = CreateLinearApproximationTable();
 }
 public CipherView(TextWriter writer, ICipher cipher, SubstitutionTable substitutionTable)
 {
     _writer            = writer;
     _cipher            = cipher;
     _substitutionTable = substitutionTable;
 }
Exemple #4
0
 public CipherTwo(SubstitutionTable substitutionTable)
 {
     SBox = substitutionTable;
 }
Exemple #5
0
 public void Rewind(RewindState rewind)
 {
     Parser.Position = rewind.Position;
     SubstitutionTable.Rewind(rewind.SubstitutionTableSize);
 }