示例#1
0
        private static SpongeState Iota(SpongeState state, int round)
        {
            int       w  = state.Size.W;
            int       l  = state.Size.L;
            Bitstring rc = Bitstring.Zeroes(w);
            RoundT    roundT;
            int       t;
            int       rnd = 7 * round;

            for (int j = 0; j <= l; j++)
            {
                t      = j + rnd;
                roundT = new RoundT(round, t);
                if (!_roundTConstants.ContainsKey(roundT))
                {
                    _roundTConstants.Add(roundT, RoundConstant(t));
                }
                rc[(1 << j) - 1] = _roundTConstants[roundT];
            }
            state.XorLane(state.GetLane(0, 0), rc);
            return(state);
        }
示例#2
0
        static SpongeState Iota(SpongeState state, int round)
        {
            var w  = state.Size.W;
            var l  = state.Size.L;
            var rc = BitString.Zeroes(w);
            int t;
            var rnd = 7 * round;

            for (var j = 0; j <= l; j++)
            {
                t = j + rnd;
                var roundT = new RoundT(round, t);
                if (!RoundTConstants.ContainsKey(roundT))
                {
                    RoundTConstants.Add(roundT, RoundConstant(t));
                }

                rc[(1 << j) - 1] = RoundTConstants[roundT];
            }

            state.XorLane(state.GetLane(0, 0), rc);
            return(state);
        }