Exemple #1
0
 private byte[] SubWord(byte[] word)
 {
     byte[] result = new byte[4];
     result[0] = SBox.Get(this.GetLeftTerm(word[0]), this.GetRightTerm(word[0]));
     result[1] = SBox.Get(this.GetLeftTerm(word[1]), this.GetRightTerm(word[1]));
     result[2] = SBox.Get(this.GetLeftTerm(word[2]), this.GetRightTerm(word[2]));
     result[3] = SBox.Get(this.GetLeftTerm(word[3]), this.GetRightTerm(word[3]));
     return(result);
 }
Exemple #2
0
        private void SubBytes()
        {
            Print("SubBytes");

            for (int row = 0; row < 4; ++row)
            {
                for (int column = 0; column < 4; ++column)
                {
                    state[row, column] = SBox.Get((this.GetLeftTerm(state[row, column])), (this.GetRightTerm(state[row, column])));
                }
            }

            PrintState();
        }