// substitute byte using sbox
 public byte[][] SubstituteByte(byte[][] currentStage)
 {
     for (int i = 0; i < Properties.Settings.Default.BLOCK_ROW_SIZE; i++)
     {
         for (int j = 0; j < Properties.Settings.Default.BLOCK_COLUMN_SIZE; j++)
         {
             currentStage[i][j] = sBoxInstance.GetSubstituteByte(currentStage[i][j], isInverse);
         }
     }
     return(currentStage);
 }
Пример #2
0
        private byte[] GetGResult(byte[] word, int keyConstantNumber)
        {
            // one byte left shift;
            byte[] result = Util.ShiftRow(word, 1, false);

            // substitute byte
            for (int i = 0; i < result.Length; i++)
            {
                result[i] = sBoxInstance.GetSubstituteByte(result[i], false); // use sbox substitution
            }
            // xor with constant
            result = Util.WordXOR(result, this.KeyConstant[keyConstantNumber]);

            return(result);
        }