Пример #1
0
        /// <summary>
        /// Performs Keccak-p on the specified message as defined by FIPS-202 Section 3.
        /// </summary>
        /// <param name="message">BitString to transform. Should already be processed by Keccak.</param>
        /// <returns>BitString</returns>
        public static BitString Keccak_p(BitString message)
        {
            var A = new KeccakState(message, _b);

            var startRound = 12 + 2 * A.L - _numRounds;
            var endRound   = 12 + 2 * A.L - 1;

            // For A.L = 6 and _numRounds = 24 which they must be for now, this loop is just... (i = 0; i <= 23; i++)
            for (var i = startRound; i <= endRound; i++)
            {
                A = Round(A, i);
            }

            return(A.ToBitString());
        }
Пример #2
0
 public static KeccakState Round(KeccakState A, int roundNumber)
 {
     return(A.Theta().Rho().Pi().Chi().Iota(roundNumber));
 }