Esempio n. 1
0
        public Shannon()
        {
            Shannon shannon = this;

            this.R     = new int[16];
            this.CRC   = new int[16];
            this.initR = new int[16];
        }
Esempio n. 2
0
        public virtual void macOnly(byte[] buffer)
        {
            int index1 = 0;
            int length = buffer.Length;

            if (this.nbuf != 0)
            {
                for (; this.nbuf != 0 && length != 0; length += -1)
                {
                    Shannon shannon  = this;
                    int     mbuf     = shannon.mbuf;
                    byte[]  numArray = buffer;
                    int     index2   = index1;
                    ++index1;
                    int num = (int)(sbyte)numArray[index2] << 32 - this.nbuf;
                    shannon.mbuf = mbuf ^ num;
                    this.nbuf   -= 8;
                }
                if (this.nbuf != 0)
                {
                    return;
                }
                this.macFunc(this.mbuf);
            }
            for (int index2 = length & -4; index1 < index2; index1 += 4)
            {
                this.cycle();
                this.macFunc((int)buffer[index1 + 3] << 24 | (int)buffer[index1 + 2] << 16 | (int)buffer[index1 + 1] << 8 | (int)buffer[index1]);
            }
            int num1 = length & 3;

            if (num1 == 0)
            {
                return;
            }
            this.cycle();
            this.mbuf = 0;
            for (this.nbuf = 32; this.nbuf != 0 && num1 != 0; num1 += -1)
            {
                Shannon shannon  = this;
                int     mbuf     = shannon.mbuf;
                byte[]  numArray = buffer;
                int     index2   = index1;
                ++index1;
                int num2 = (int)(sbyte)numArray[index2] << 32 - this.nbuf;
                shannon.mbuf = mbuf ^ num2;
                this.nbuf   -= 8;
            }
        }