Aes

如何在 GF(2)(布爾值)中執行 AES MixColumns 作為矩陣乘法?

  • February 28, 2016

AES MixColumns 是通過乘以一個 $ 4 \times 4 $ 矩陣和 AES 狀態的列(向量)。加法和乘法在 $ \operatorname{GF}(2^8) $ .

在論文White-box AES中,作者使用 $ 32 \times 32 $ 矩陣 $ \mathit{MC} $ 次 $ 32 \times 1 $ 向量結束 $ \operatorname{GF}(2) $ .

我的問題是這是怎麼回事 $ 32 \times 32 $ 構造矩陣?或者更一般地說,矩陣乘法如何 $ \operatorname{GF}(2^8) $ 映射到乘法 $ \operatorname{GF}(2) $ ?

假設我們必須計算 $ M\times x $ , 在哪裡 $ M $ 是一個 $ n\times n $ 矩陣,和 $ x $ 是一個 $ n\times 1 $ 向量,所有條目 $ M $ 和 $ x $ 在 $ GF(2^8) $ .

我們有:

$$ M\times x = M \times \left( \begin{matrix} x_0 \ x_1 \ \vdots \x_{n-1}\end{matrix}\right) = M \times \left( \begin{matrix} x_0 \ 0\ \vdots \ 0\end{matrix}\right) \oplus M \times \left( \begin{matrix} 0 \ x_1 \ \vdots \ 0\end{matrix}\right) \oplus M \times \left( \begin{matrix} 0 \ 0 \ \vdots \x_{n-1}\end{matrix}\right) $$ 寫每個 $ x_i $ 多項式格式: $ x_i = x_{i, 0} x^0 + x_{i, 1} x ^ 1 + \ldots x_{i, 7} x ^ 7, x_{i,j} \in \lbrace 0, 1 \rbrace $ ,相當於二進制形式: $ x_i = x_{i,0}x_{i,1}\ldots x_{i,7} $ (小端符號)。我們有:

$$ M \times \left( \begin{matrix} 0 \ \vdots \ x_i \ \vdots \ 0\end{matrix}\right) = M \times \left( \begin{matrix} 0 \ \vdots \ \left(\begin{matrix} x_{i, 0} \ \vdots \ x_{i,7} \end{matrix} \right) \ \vdots \ 0\end{matrix}\right) \ = M \times \left( \begin{matrix} 0 \ \vdots \ \left(\begin{matrix} x_{i, 0} \ 0 \ \vdots \ 0 \end{matrix} \right) \ \vdots \ 0\end{matrix}\right) \oplus M \times \left( \begin{matrix} 0 \ \vdots \ \left(\begin{matrix} 0 \ x_{i,1} \ \vdots \ 0 \end{matrix} \right) \ \vdots \ 0\end{matrix}\right) \oplus \ldots \oplus M \times \left( \begin{matrix} 0 \ \vdots \ \left(\begin{matrix} 0 \ 0 \ \vdots \ x_{i,7} \end{matrix} \right) \ \vdots \ 0\end{matrix}\right) $$ (注意 $ \left(0, , \ldots x_{i,j} \ldots, 0 \right)^T $ 仍然被解釋為一個字節。) 現在,作為 $ x_{i,j} \in {0, 1} $ ,我們可以檢查:

$$ M \times \left( \begin{matrix} 0 \ \vdots \ \left(\begin{matrix} 0 \ \vdots \ x_{i,j} \ \vdots \ 0 \end{matrix} \right) \ \vdots \ 0\end{matrix}\right) = x_{i, j} \times M \times \left( \begin{matrix} 0 \ \vdots \ \left(\begin{matrix} 0 \ \vdots \ 1 \ \vdots \ 0 \end{matrix} \right) \ \vdots \ 0\end{matrix}\right) = x_{i, j} \times V_{i,j} $$ 因此:

$$ M \times x = \bigoplus_{0\leq i \leq n, 0\leq j \leq 7} x_{i, j} V_{i, j} $$ $ V_{i,j} $ 是一個 $ n\times 1 $ 向量,它的條目在 $ GF(2^8) $ . 我們可以檢查寫作 $ V_{i, j} $ 在 $ 8n\times 1 $ 二進制格式(我們稱之為 $ V’{i,j} $ ) 不會改變結果。所以我們有: $$ M \times x \mbox{ is equivalent to } \bigoplus{0\leq i \leq n, 0\leq j \leq 7} x_{i, j} V’{i, j} \ = (V’{0, 0}|| V’{0, 1} || \ldots || V’{n, 7}) (x_{0, 0}, x_{0, 1}, \ldots x_{n, 7})^T $$ 讓 $ MC = (V’{0, 0}|| V’{0, 1} || \ldots || V’{n, 7}) $ ,這是一個 $ 8n\times 8n $ 矩陣由 $ 8n\times 1 $ 向量,我們有: $$ M \times x \mbox{ is equivalent to } MC \times (x{0, 0}, x_{0, 1}, \ldots x_{n, 7})^T $$ 因此,我們將矩陣乘法轉換為 $ GF(2^8) $ 矩陣乘法 $ GF(2) $ .

感謝我的主管的這個答案。

引用自:https://crypto.stackexchange.com/questions/33085