Usuário:Josepaulolima/Advanced Encryption Standard: diferenças entre revisões

Conteúdo apagado Conteúdo adicionado
Linha 84:
 
=== O passo <tt>MixColumns</tt> ===
{{Principal|MixColumns de Rijndael}}
[[Ficheiro:AES-MixColumns.svg|direita|miniaturadaimagem|320x320px| Na etapa <tt>MixColumns</tt> , cada coluna do estado é multiplicada por um polinômio fixo <math xmlns="http://www.w3.org/1998/Math/MathML"><mrow class="MJX-TeXAtom-ORD"><mi> <math>c(x)</math> </mi><mo stretchy="false"> <math>c(x)</math> </mo><mi> <math>c(x)</math> </mi><mo stretchy="false"> <math>c(x)</math> </mo></mrow> </math><math>c(x)</math> <math>c(x)</math> </img> <span></span> . ]]
 
[[Ficheiro:AES-MixColumns.svg|direita|miniaturadaimagem|320x320px| Na etapa <tt>MixColumns</tt> , cada coluna do estado é multiplicada por um polinômio fixo <math>c(x)</math>.]]
 
Na etapa <tt>MixColumns</tt> , os quatro bytes de cada coluna do estado são combinados usando uma [[transformação linear]] invertível. A função <tt>MixColumns</tt> usa quatro bytes como entrada e gera quatro bytes, onde cada byte de entrada afeta todos os quatro bytes de saída. Juntamente com <tt>ShiftRows</tt> , <tt>MixColumns</tt> fornece difusão na cifra.
 
Linha 103 ⟶ 106:
</math>
 
A multiplicação de matrizes é composta de multiplicação e adição das entradas. Entradas são bytes de 8 bits tratados como coeficientes de polinômio de ordem <math xmlns="http://www.w3.org/1998/Math/MathML"><mrow class="MJX-TeXAtom-ORD"><msup><mi> <math>x^7</math> </mi><mrow class="MJX-TeXAtom-ORD"><mn> <math>x^7</math> </mn></mrow></msup></mrow> </math><math>x^7</math> <math>x^7</math> </img> <span></span> . A adição é simplesmente XOR. A multiplicação é um polinômio modular irredutível <math xmlns="http://www.w3.org/1998/Math/MathML"><mrow class="MJX-TeXAtom-ORD"><msup><mi> <math>x^8+x^4+x^3+x+1</math> </mi><mrow class="MJX-TeXAtom-ORD"><mn> <math>x^8+x^4+x^3+x+1</math> </mn></mrow></msup><mo> <math>x^8+x^4+x^3+x+1</math> </mo><msup><mi> <math>x^8+x^4+x^3+x+1</math> </mi><mrow class="MJX-TeXAtom-ORD"><mn> <math>x^8+x^4+x^3+x+1</math> </mn></mrow></msup><mo> <math>x^8+x^4+x^3+x+1</math> </mo><msup><mi> <math>x^8+x^4+x^3+x+1</math> </mi><mrow class="MJX-TeXAtom-ORD"><mn> <math>x^8+x^4+x^3+x+1</math> </mn></mrow></msup><mo> <math>x^8+x^4+x^3+x+1</math> </mo><mi> <math>x^8+x^4+x^3+x+1</math> </mi><mo> <math>x^8+x^4+x^3+x+1</math> </mo><mn> <math>x^8+x^4+x^3+x+1</math> </mn></mrow> </math><math>x^8+x^4+x^3+x+1</math> <math>x^8+x^4+x^3+x+1</math> </img> <span></span> . Se processado pouco a pouco, então, após a mudança, um [[Porta XOR|XOR]] condicional com 1B <sub>16</sub> deve ser executado se o valor deslocado for maior que FF <sub>16</sub> (o transbordamento deve ser corrigido pela subtração do polinômio gerador). Estes são casos especiais da multiplicação usual em <math xmlns="http://www.w3.org/1998/Math/MathML"><mrow class="MJX-TeXAtom-ORD"><mi> <math>\operatorname{GF}(2^8)</math> </mi><mo> <math>\operatorname{GF}(2^8)</math> </mo><mo stretchy="false"> <math>\operatorname{GF}(2^8)</math> </mo><msup><mn> <math>\operatorname{GF}(2^8)</math> </mn><mrow class="MJX-TeXAtom-ORD"><mn> <math>\operatorname{GF}(2^8)</math> </mn></mrow></msup><mo stretchy="false"> <math>\operatorname{GF}(2^8)</math> </mo></mrow> </math><math>\operatorname{GF}(2^8)</math> <math>\operatorname{GF}(2^8)</math> </img> <span></span> .
 
Em um sentido mais geral, cada coluna é tratada como um polinômio <math>\operatorname{GF}(2^8)</math> e é então multiplicado módulo <math>{01}_{16} \cdot z^4+{01}_{16}</math> com um polinômio fixo <math>c(z) = {03}_{16} \cdot z^3 + {01}_{16} \cdot z^2 +{01}_{16} \cdot z + {02}_{16}</math>. Os coeficientes são exibidos em seu equivalente [[Sistema de numeração hexadecimal|hexadecimal]] da representação binária de polinômios de bit de <math>\operatorname{GF}(2)[x]</math>. O passo <tt>MixColumns</tt> também pode ser visto como uma multiplicação pela matriz MDS particular mostrada no [[Corpo finito|campo finito]]<math>\operatorname{GF}(2^8)</math>. Este processo é descrito mais adiante no artigo Rijndael MixColumns .
Em um sentido mais geral, cada coluna é tratada como um polinômio <math xmlns="http://www.w3.org/1998/Math/MathML"><mrow class="MJX-TeXAtom-ORD"><mi> <math>\operatorname{GF}(2^8)</math> </mi><mo> <math>\operatorname{GF}(2^8)</math> </mo><mo stretchy="false"> <math>\operatorname{GF}(2^8)</math> </mo><msup><mn> <math>\operatorname{GF}(2^8)</math> </mn><mrow class="MJX-TeXAtom-ORD"><mn> <math>\operatorname{GF}(2^8)</math> </mn></mrow></msup><mo stretchy="false"> <math>\operatorname{GF}(2^8)</math> </mo></mrow> </math><math>\operatorname{GF}(2^8)</math> <math>\operatorname{GF}(2^8)</math> </img> <span></span> e é então multiplicado módulo <math xmlns="http://www.w3.org/1998/Math/MathML"><mrow class="MJX-TeXAtom-ORD"><msub><mrow class="MJX-TeXAtom-ORD"><mn> <math>{01}_{16} \cdot z^4+{01}_{16}</math> </mn></mrow><mrow class="MJX-TeXAtom-ORD"><mn> <math>{01}_{16} \cdot z^4+{01}_{16}</math> </mn></mrow></msub><mo> <math>{01}_{16} \cdot z^4+{01}_{16}</math> </mo><msup><mi> <math>{01}_{16} \cdot z^4+{01}_{16}</math> </mi><mrow class="MJX-TeXAtom-ORD"><mn> <math>{01}_{16} \cdot z^4+{01}_{16}</math> </mn></mrow></msup><mo> <math>{01}_{16} \cdot z^4+{01}_{16}</math> </mo><msub><mrow class="MJX-TeXAtom-ORD"><mn> <math>{01}_{16} \cdot z^4+{01}_{16}</math> </mn></mrow><mrow class="MJX-TeXAtom-ORD"><mn> <math>{01}_{16} \cdot z^4+{01}_{16}</math> </mn></mrow></msub></mrow> </math><math>{01}_{16} \cdot z^4+{01}_{16}</math> <math>{01}_{16} \cdot z^4+{01}_{16}</math> </img> <span></span> com um polinômio fixo <math xmlns="http://www.w3.org/1998/Math/MathML"><mrow class="MJX-TeXAtom-ORD"><mi> <math>c(z) = {03}_{16} \cdot z^3 + {01}_{16} \cdot z^2 +{01}_{16} \cdot z + {02}_{16}</math> </mi><mo stretchy="false"> <math>c(z) = {03}_{16} \cdot z^3 + {01}_{16} \cdot z^2 +{01}_{16} \cdot z + {02}_{16}</math> </mo><mi> <math>c(z) = {03}_{16} \cdot z^3 + {01}_{16} \cdot z^2 +{01}_{16} \cdot z + {02}_{16}</math> </mi><mo stretchy="false"> <math>c(z) = {03}_{16} \cdot z^3 + {01}_{16} \cdot z^2 +{01}_{16} \cdot z + {02}_{16}</math> </mo><mo> <math>c(z) = {03}_{16} \cdot z^3 + {01}_{16} \cdot z^2 +{01}_{16} \cdot z + {02}_{16}</math> </mo><msub><mrow class="MJX-TeXAtom-ORD"><mn> <math>c(z) = {03}_{16} \cdot z^3 + {01}_{16} \cdot z^2 +{01}_{16} \cdot z + {02}_{16}</math> </mn></mrow><mrow class="MJX-TeXAtom-ORD"><mn> <math>c(z) = {03}_{16} \cdot z^3 + {01}_{16} \cdot z^2 +{01}_{16} \cdot z + {02}_{16}</math> </mn></mrow></msub><mo> <math>c(z) = {03}_{16} \cdot z^3 + {01}_{16} \cdot z^2 +{01}_{16} \cdot z + {02}_{16}</math> </mo><msup><mi> <math>c(z) = {03}_{16} \cdot z^3 + {01}_{16} \cdot z^2 +{01}_{16} \cdot z + {02}_{16}</math> </mi><mrow class="MJX-TeXAtom-ORD"><mn> <math>c(z) = {03}_{16} \cdot z^3 + {01}_{16} \cdot z^2 +{01}_{16} \cdot z + {02}_{16}</math> </mn></mrow></msup><mo> <math>c(z) = {03}_{16} \cdot z^3 + {01}_{16} \cdot z^2 +{01}_{16} \cdot z + {02}_{16}</math> </mo><msub><mrow class="MJX-TeXAtom-ORD"><mn> <math>c(z) = {03}_{16} \cdot z^3 + {01}_{16} \cdot z^2 +{01}_{16} \cdot z + {02}_{16}</math> </mn></mrow><mrow class="MJX-TeXAtom-ORD"><mn> <math>c(z) = {03}_{16} \cdot z^3 + {01}_{16} \cdot z^2 +{01}_{16} \cdot z + {02}_{16}</math> </mn></mrow></msub><mo> <math>c(z) = {03}_{16} \cdot z^3 + {01}_{16} \cdot z^2 +{01}_{16} \cdot z + {02}_{16}</math> </mo><msup><mi> <math>c(z) = {03}_{16} \cdot z^3 + {01}_{16} \cdot z^2 +{01}_{16} \cdot z + {02}_{16}</math> </mi><mrow class="MJX-TeXAtom-ORD"><mn> <math>c(z) = {03}_{16} \cdot z^3 + {01}_{16} \cdot z^2 +{01}_{16} \cdot z + {02}_{16}</math> </mn></mrow></msup><mo> <math>c(z) = {03}_{16} \cdot z^3 + {01}_{16} \cdot z^2 +{01}_{16} \cdot z + {02}_{16}</math> </mo><msub><mrow class="MJX-TeXAtom-ORD"><mn> <math>c(z) = {03}_{16} \cdot z^3 + {01}_{16} \cdot z^2 +{01}_{16} \cdot z + {02}_{16}</math> </mn></mrow><mrow class="MJX-TeXAtom-ORD"><mn> <math>c(z) = {03}_{16} \cdot z^3 + {01}_{16} \cdot z^2 +{01}_{16} \cdot z + {02}_{16}</math> </mn></mrow></msub><mo> <math>c(z) = {03}_{16} \cdot z^3 + {01}_{16} \cdot z^2 +{01}_{16} \cdot z + {02}_{16}</math> </mo><mi> <math>c(z) = {03}_{16} \cdot z^3 + {01}_{16} \cdot z^2 +{01}_{16} \cdot z + {02}_{16}</math> </mi><mo> <math>c(z) = {03}_{16} \cdot z^3 + {01}_{16} \cdot z^2 +{01}_{16} \cdot z + {02}_{16}</math> </mo><msub><mrow class="MJX-TeXAtom-ORD"><mn> <math>c(z) = {03}_{16} \cdot z^3 + {01}_{16} \cdot z^2 +{01}_{16} \cdot z + {02}_{16}</math> </mn></mrow><mrow class="MJX-TeXAtom-ORD"><mn> <math>c(z) = {03}_{16} \cdot z^3 + {01}_{16} \cdot z^2 +{01}_{16} \cdot z + {02}_{16}</math> </mn></mrow></msub></mrow> </math><math>c(z) = {03}_{16} \cdot z^3 + {01}_{16} \cdot z^2 +{01}_{16} \cdot z + {02}_{16}</math> <math>c(z) = {03}_{16} \cdot z^3 + {01}_{16} \cdot z^2 +{01}_{16} \cdot z + {02}_{16}</math> </img> <span></span> . Os coeficientes são exibidos em seu equivalente [[Sistema de numeração hexadecimal|hexadecimal]] da representação binária de polinômios de bit de <math xmlns="http://www.w3.org/1998/Math/MathML"><mrow class="MJX-TeXAtom-ORD"><mi> <math>\operatorname{GF}(2)[x]</math> </mi><mo> <math>\operatorname{GF}(2)[x]</math> </mo><mo stretchy="false"> <math>\operatorname{GF}(2)[x]</math> </mo><mn> <math>\operatorname{GF}(2)[x]</math> </mn><mo stretchy="false"> <math>\operatorname{GF}(2)[x]</math> </mo><mo stretchy="false"> <math>\operatorname{GF}(2)[x]</math> </mo><mi> <math>\operatorname{GF}(2)[x]</math> </mi><mo stretchy="false"> <math>\operatorname{GF}(2)[x]</math> </mo></mrow> </math><math>\operatorname{GF}(2)[x]</math> <math>\operatorname{GF}(2)[x]</math> </img> <span></span> . O passo <tt>MixColumns</tt> também pode ser visto como uma multiplicação pela matriz MDS particular mostrada no [[Corpo finito|campo finito]] <math xmlns="http://www.w3.org/1998/Math/MathML"><mrow class="MJX-TeXAtom-ORD"><mi> <math>\operatorname{GF}(2^8)</math> </mi><mo> <math>\operatorname{GF}(2^8)</math> </mo><mo stretchy="false"> <math>\operatorname{GF}(2^8)</math> </mo><msup><mn> <math>\operatorname{GF}(2^8)</math> </mn><mrow class="MJX-TeXAtom-ORD"><mn> <math>\operatorname{GF}(2^8)</math> </mn></mrow></msup><mo stretchy="false"> <math>\operatorname{GF}(2^8)</math> </mo></mrow> </math><math>\operatorname{GF}(2^8)</math> <math>\operatorname{GF}(2^8)</math> </img> <span></span> . Este processo é descrito mais adiante no artigo Rijndael MixColumns .
 
=== O passo <tt>AddRoundKey</tt> ===