Esempio n. 1
0
        private static bool RoundConstant(int t)
        {
            t = Bin.Mod(t, 255);
            if (_roundConstants.ContainsKey(t))
            {
                return(_roundConstants[t]);
            }
            Bitstring r = new Bitstring("10000000", 8);

            for (int i = 0; i < t; i++)
            {
                r.Prepend(Bitstring.Zero);
                r[0] ^= r[8];
                r[4] ^= r[8];
                r[5] ^= r[8];
                r[6] ^= r[8];
                r     = r.Truncate(8);
            }
            bool bit = r[0];

            _roundConstants.Add(t, bit);
            return(bit);
        }