Пример #1
0
        /// <remarks>
        /// Apply the inverse of the linear transformation to the register set
        /// </remarks>
        private void InverseTransform(ref uint R0, ref uint R1, ref uint R2, ref uint R3)
        {
            uint x2 = IntUtils.RotateRight(R2, 22) ^ R3 ^ (R1 << 7);
            uint x0 = IntUtils.RotateRight(R0, 5) ^ R1 ^ R3;
            uint x3 = IntUtils.RotateRight(R3, 7);
            uint x1 = IntUtils.RotateRight(R1, 1);

            R3 = x3 ^ x2 ^ x0 << 3;
            R1 = x1 ^ x0 ^ x2;
            R2 = IntUtils.RotateRight(x2, 3);
            R0 = IntUtils.RotateRight(x0, 13);
        }
Пример #2
0
        /// <remarks>
        /// Apply the inverse of the linear transformation to the register set
        /// </remarks>
        private void InverseTransform(ref UInt32 R0, ref UInt32 R1, ref UInt32 R2, ref UInt32 R3)
        {
            UInt32 x2 = IntUtils.RotateRight(R2, 22) ^ R3 ^ (R1 << 7);
            UInt32 x0 = IntUtils.RotateRight(R0, 5) ^ R1 ^ R3;
            UInt32 x3 = IntUtils.RotateRight(R3, 7);
            UInt32 x1 = IntUtils.RotateRight(R1, 1);

            R3 = x3 ^ x2 ^ x0 << 3;
            R1 = x1 ^ x0 ^ x2;
            R2 = IntUtils.RotateRight(x2, 3);
            R0 = IntUtils.RotateRight(x0, 13);
        }
Пример #3
0
        void Mix(uint A, uint B, uint C, uint D, uint R, uint I)
        {
            uint P  = (R << 4) + I;
            uint P0 = _ftSigma[P];
            uint P1 = _ftSigma[P + 1];

            _V[A] += _V[B] + (_M[P0] ^ _C32[P1]);
            _V[D]  = IntUtils.RotateRight(_V[D] ^ _V[A], 16);
            _V[C] += _V[D];
            _V[B]  = IntUtils.RotateRight(_V[B] ^ _V[C], 12);
            _V[A] += _V[B] + (_M[P1] ^ _C32[P0]);
            _V[D]  = IntUtils.RotateRight(_V[D] ^ _V[A], 8);
            _V[C] += _V[D];
            _V[B]  = IntUtils.RotateRight(_V[B] ^ _V[C], 7);
        }
Пример #4
0
        private void Mix(uint A, uint B, uint C, uint D, uint R, uint I)
        {
            uint P  = (R << 4) + I;
            uint P0 = _ftSigma[P];
            uint P1 = _ftSigma[P + 1];

            // initialization
            _V[A] += _V[B] + (_M[P0] ^ _C64[P1]);
            _V[D]  = IntUtils.RotateRight(_V[D] ^ _V[A], 32);
            _V[C] += _V[D];
            _V[B]  = IntUtils.RotateRight(_V[B] ^ _V[C], 25);
            _V[A] += _V[B] + (_M[P1] ^ _C64[P0]);
            _V[D]  = IntUtils.RotateRight(_V[D] ^ _V[A], 16);
            _V[C] += _V[D];
            _V[B]  = IntUtils.RotateRight(_V[B] ^ _V[C], 11);
        }