Пример #1
0
        public void h_CalculateshValue_Calculated()
        {
            uint expected = 579114735;
            uint result   = TwofishFunction.h(new TwofishMDS(), 261617515, new uint[] { 2715, 515187, 1251512, 215815 });

            Assert.AreEqual(expected, result);
        }
Пример #2
0
        private uint[] Round(ITwofishMDS mds, uint[] K, int round)
        {
            uint F0 = TwofishFunction.h(mds, K[0], _key.SBox);
            uint F1 = TwofishFunction.h(mds, Word32Bits.RotateLeft(K[1], 8), _key.SBox);

            K[2] ^= F0 + F1 + _key.K[2 * round + 8];
            K[2]  = Word32Bits.RotateRight(K[2], 1);
            K[3]  = Word32Bits.RotateLeft(K[3], 1) ^ (F0 + 2 * F1 + _key.K[2 * round + 9]);
            return(K);
        }