예제 #1
0
        public void InitializeRotors()
        {
            CodeWheels = new RotorByte[16];

            CipherRotors  = new RotorByte[5];
            ControlRotors = new RotorByte[5];
            IndexRotors   = new RotorByte[5];

            CodeWheels[0] = new RotorByte(ConstantsByte.ControlCipherRotors[0], 0, false);
            CodeWheels[1] = CipherRotors[0] = new RotorByte(ConstantsByte.ControlCipherRotors[1], 0, false);
            CodeWheels[2] = CipherRotors[1] = new RotorByte(ConstantsByte.ControlCipherRotors[2], 0, false);
            CodeWheels[3] = CipherRotors[2] = new RotorByte(ConstantsByte.ControlCipherRotors[3], 0, false);
            CodeWheels[4] = CipherRotors[3] = new RotorByte(ConstantsByte.ControlCipherRotors[4], 0, false);
            CodeWheels[5] = CipherRotors[4] = new RotorByte(ConstantsByte.ControlCipherRotors[5], 0, false);

            CodeWheels[6]  = new RotorByte(ConstantsByte.ControlCipherRotors[6], 0, false);
            CodeWheels[7]  = new RotorByte(ConstantsByte.ControlCipherRotors[7], 0, false);
            CodeWheels[8]  = new RotorByte(ConstantsByte.ControlCipherRotors[8], 0, false);
            CodeWheels[9]  = new RotorByte(ConstantsByte.ControlCipherRotors[9], 0, false);
            CodeWheels[10] = new RotorByte(ConstantsByte.ControlCipherRotors[10], 0, false);

            /*
             * CodeWheels[11] = IndexRotors[0] = new RotorByte(ConstantsByte.IndexRotors[1], 0, false);
             * CodeWheels[12] = IndexRotors[1] = new RotorByte(ConstantsByte.IndexRotors[2], 0, false);
             * CodeWheels[13] = IndexRotors[2] = new RotorByte(ConstantsByte.IndexRotors[3], 0, false);
             * CodeWheels[14] = IndexRotors[3] = new RotorByte(ConstantsByte.IndexRotors[4], 0, false);
             * CodeWheels[15] = IndexRotors[4] = new RotorByte(ConstantsByte.IndexRotors[5], 0, false);*/
        }
예제 #2
0
        public void setCodeWheels(int[] phase1Wheels)
        {
            int count = 0;

            for (int ccr = 1; ccr < ConstantsByte.ControlCipherRotors.Length; ccr++)
            {
                if (!phase1Wheels.Contains(ccr))
                {
                    CodeWheels2[count] = new RotorByte(ConstantsByte.ControlCipherRotors[ccr], 0, false);
                    realWheels[count]  = ccr;
                    count++;
                }
            }

            //this.keys = keys;
        }