private void InvMixColumns(ref int[,] arr) { int[] temp = new int[4]; int[,] mc = { { 14, 11, 13, 9 }, { 9, 14, 11, 13 }, { 13, 9, 14, 11 }, { 11, 13, 9, 14 } }; for (int col = 0; col < 4; col++) { int res; for (int i = 0; i < 4; i++) { res = 0; for (int j = 0; j < 4; j++) { res ^= Kripto.GF_8(mc[i, j], arr[j, col]); } temp[i] = res; } for (int i = 0; i < 4; i++) { arr[i, col] = temp[i]; } } }
private void MixColumns(ref int[,] arr) { int[] temp = new int[4]; int[,] mc = { { 2, 3, 1, 1 }, { 1, 2, 3, 1 }, { 1, 1, 2, 3 }, { 3, 1, 1, 2 } }; for (int col = 0; col < 4; col++) { int res; for (int i = 0; i < 4; i++) { res = 0; for (int j = 0; j < 4; j++) { res ^= Kripto.GF_8(mc[i, j], arr[j, col]); } temp[i] = res; } for (int i = 0; i < 4; i++) { arr[i, col] = temp[i]; } } }