<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE article  PUBLIC "-//NLM//DTD Journal Publishing DTD v3.0 20080202//EN" "http://dtd.nlm.nih.gov/publishing/3.0/journalpublishing3.dtd"><article xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink" dtd-version="3.0" xml:lang="en" article-type="research article"><front><journal-meta><journal-id journal-id-type="publisher-id">AM</journal-id><journal-title-group><journal-title>Applied Mathematics</journal-title></journal-title-group><issn pub-type="epub">2152-7385</issn><publisher><publisher-name>Scientific Research Publishing</publisher-name></publisher></journal-meta><article-meta><article-id pub-id-type="doi">10.4236/am.2019.103010</article-id><article-id pub-id-type="publisher-id">AM-91453</article-id><article-categories><subj-group subj-group-type="heading"><subject>Articles</subject></subj-group><subj-group subj-group-type="Discipline-v2"><subject>Physics&amp;Mathematics</subject></subj-group></article-categories><title-group><article-title>
 
 
  On Rijndael ByteSub Transformation
 
</article-title></title-group><contrib-group><contrib contrib-type="author" xlink:type="simple"><name name-style="western"><surname>W.</surname><given-names>Eltayeb Ahmed</given-names></name><xref ref-type="aff" rid="aff1"><sub>1</sub></xref><xref ref-type="corresp" rid="cor1"><sup>*</sup></xref></contrib></contrib-group><aff id="aff1"><label>1</label><addr-line>Mathematics and Statistics Department, Faculty of Science, Imam Mohammad Ibn Saud Islamic University, Riyadh, KSA</addr-line></aff><pub-date pub-type="epub"><day>15</day><month>03</month><year>2019</year></pub-date><volume>10</volume><issue>03</issue><fpage>113</fpage><lpage>118</lpage><history><date date-type="received"><day>2,</day>	<month>March</month>	<year>2019</year></date><date date-type="rev-recd"><day>25,</day>	<month>March</month>	<year>2019</year>	</date><date date-type="accepted"><day>28,</day>	<month>March</month>	<year>2019</year></date></history><permissions><copyright-statement>&#169; Copyright  2014 by authors and Scientific Research Publishing Inc. </copyright-statement><copyright-year>2014</copyright-year><license><license-p>This work is licensed under the Creative Commons Attribution International License (CC BY). http://creativecommons.org/licenses/by/4.0/</license-p></license></permissions><abstract><p>
 
 
  The first step in converting a plaintext to ciphertext by the famous Advanced Encryption Standard (AES), which is called Rijndael ByteSub Transformation, involves some operations: computing a multiplicative inverse, multiplying this multiplicative inverse by a specific matrix, and adding the result to a specific vector. The purpose of this research is to simplify these operations. This paper gives elegant techniques and presents the matrices multiplication as simple XOR operations, and the result is a simple, straightforward way find
  ing
   the transformation.
 
</p></abstract><kwd-group><kwd>Rijndael Cipher</kwd><kwd> Advanced Encryption Standard</kwd><kwd> Multiplicative Inverse</kwd><kwd> XOR Operation</kwd></kwd-group></article-meta></front><body><sec id="s1"><title>1. Introduction</title><p>Rijndael ByteSub transformation (or AES substitution byte) [<xref ref-type="bibr" rid="scirp.91453-ref1">1</xref>] transforms an input byte into another byte by two operations:</p><p>1) Finding a multiplicative inverse of an input byte ( a 7 a 6 a 5 a 4 a 3 a 2 a 1 a 0 ) in the finite field GF (2<sup>8</sup>).</p><p>2) Applying the following affine transform:</p><p>c i = b i + b ( i + 4 ) mod ( 8 ) + b ( i + 5 ) mod ( 8 ) + b ( i + 6 ) mod ( 8 )             + b ( i + 7 ) mod ( 8 ) + d i ,     0 ≤ i ≤ 7 (1)</p><p>where ( b 7 b 6 b 5 b 4 b 3 b 2 b 1 b 0 ) is resulting from the first operation, ( d 7 d 6 d 5 d 4 d 3 d 2 d 1 d 0 ) = 01100011 .</p><p>In general, the multiplicative inverse is found by using the extended Euclidean algorithm [<xref ref-type="bibr" rid="scirp.91453-ref2">2</xref>] , instead of using it, we use an elegant technique which finds the multiplicative inverse in clear steps.</p><p>The transform of the second operation can be expressed in the matrix form as:</p><p>[ c 0 c 1 c 2 c 3 c 4 c 5 c 6 c 7 ] = [ 1 0 0 0 1 1 1 1 1 1 0 0 0 1 1 1 1 1 1 0 0 0 1 1 1 1 1 1 0 0 0 1 1 1 1 1 1 0 0 0 0 1 1 1 1 1 0 0 0 0 1 1 1 1 1 0 0 0 0 1 1 1 1 1 ] [ b 0 b 1 b 2 b 3 b 4 b 5 b 6 b 7 ] + [ 1 1 0 0 0 1 1 0 ] (2)</p><p>To solve this system, we use an unusual and more suitable technique which shows this multiplication of matrix (8 &#215; 8) and matrix (8 &#215; 1) as simple XOR operations, and we can find it directly from ( b 7 b 6 b 5 b 4 b 3 b 2 b 1 b 0 ) .</p></sec><sec id="s2"><title>2. The Methodology</title><p>For an input byte ( a 7 a 6 a 5 a 4 a 3 a 2 a 1 a 0 ) , we find its multiplicative inverse ( b 7 b 6 b 5 b 4 b 3 b 2 b 1 b 0 ) , and find ( e 7 e 6 e 5 e 4 e 3 e 2 e 1 e 0 ) such that:</p><p>[ e 0 e 1 e 2 e 3 e 4 e 5 e 6 e 7 ] = [ 1 0 0 0 1 1 1 1 1 1 0 0 0 1 1 1 1 1 1 0 0 0 1 1 1 1 1 1 0 0 0 1 1 1 1 1 1 0 0 0 0 1 1 1 1 1 0 0 0 0 1 1 1 1 1 0 0 0 0 1 1 1 1 1 ] [ b 0 b 1 b 2 b 3 b 4 b 5 b 6 b 7 ] (3)</p><p>Then, we find the output ( c 7 c 6 c 5 c 4 c 3 c 2 c 1 c 0 ) as:</p><p>[ c 0 c 1 c 2 c 3 c 4 c 5 c 6 c 7 ] = [ e 0 e 1 e 2 e 3 e 4 e 5 e 6 e 7 ] + [ 1 1 0 0 0 1 1 0 ] (4)</p><p>First, we find a multiplicative inverse of a 7 x 7 + a 6 x 6 + a 5 x 5 + a 4 x 4 + a 3 x 3 + a 2 x 2 + a 1 x + a 0 mod ( x 8 + x 4 + x 3 + x + 1 ) .</p><p>Let M 1 = a 7 x 7 + a 6 x 6 + a 5 x 5 + a 4 x 4 + a 3 x 3 + a 2 x 2 + a 1 x + a 0 , P = x 8 + x 4 + x 3 + x + 1 , and represent the multiplicative inverse by T.</p><p>We seek for q 1 and r 1 satisfying:</p><p>M 1 q 1 + r 1 = Q 1 (5)</p><p>where Q 1 = P + 1 [<xref ref-type="bibr" rid="scirp.91453-ref3">3</xref>] , (look at <xref ref-type="table" rid="table1">Table 1</xref>).</p><p>If r 1 = 0 , then T = q 1 .</p><p>If r 1 ≠ 0 , we let M 2 = r 1 + 1 and seek for q i and r i satisfying:</p><p>M i q i + r i = Q i ,     2 ≤ i ≤ 7 (6)</p><p>where Q i = M i − 1 , and M i + 1 = r i (look at <xref ref-type="table" rid="table2">Table 2</xref>).</p><p>Whenever r i = 1 , then</p><p>T = T i = q i T i − 1 + T i − 2 (7)</p><p>where T 0 = 1 , and T 1 = q 1 .</p><p>Then, to find ( e 7 e 6 e 5 e 4 e 3 e 2 e 1 e 0 ) , we write the system (3), as follows:</p><p>[ e ] = [ X Y Y X ] [ b ] (8)</p><p>e i = X b i + Y b j (9)</p><p>e j = Y b i + X b j (10)</p><p>where 0 ≤ i ≤ 3 , 4 ≤ j ≤ 7 , and</p><p>X = [ 1 0 0 0 1 1 1 1 1 1 0 1 1 0 0 1 ] (11)</p><p>Y = [ 1 1 0 1 1 1 1 1 0 0 0 0 1 1 0 1 ] (12)</p><p>b i = [ b 0 b 1 b 2 b 3 ] ,     b j = [ b 4 b 5 b 6 b 7 ] (13)</p><table-wrap id="table1" ><label><xref ref-type="table" rid="table1">Table 1</xref></label><caption><title> First step to find the multiplicative inverse</title></caption><table><tbody><thead><tr><th align="center" valign="middle" >i</th><th align="center" valign="middle" >M</th><th align="center" valign="middle" >q</th><th align="center" valign="middle" >r</th><th align="center" valign="middle" >Q</th></tr></thead><tr><td align="center" valign="middle" >1</td><td align="center" valign="middle" >M 1</td><td align="center" valign="middle" >q 1</td><td align="center" valign="middle" >r 1</td><td align="center" valign="middle" >Q 1 = P + 1</td></tr></tbody></table></table-wrap><table-wrap id="table2" ><label><xref ref-type="table" rid="table2">Table 2</xref></label><caption><title> All steps to find the multiplicative inverse</title></caption><table><tbody><thead><tr><th align="center" valign="middle" >i</th><th align="center" valign="middle" >M</th><th align="center" valign="middle" >q</th><th align="center" valign="middle" >r</th><th align="center" valign="middle" >Q</th></tr></thead><tr><td align="center" valign="middle" >1</td><td align="center" valign="middle" >M 1</td><td align="center" valign="middle" >q 1</td><td align="center" valign="middle" >r 1</td><td align="center" valign="middle" >Q 1 = P + 1</td></tr><tr><td align="center" valign="middle" >2</td><td align="center" valign="middle" >M 2 = r 1 + 1</td><td align="center" valign="middle" >q 2</td><td align="center" valign="middle" >r 2</td><td align="center" valign="middle" >Q 2 = M 1</td></tr><tr><td align="center" valign="middle" >3</td><td align="center" valign="middle" >M 3 = r 2</td><td align="center" valign="middle" >q 3</td><td align="center" valign="middle" >r 3</td><td align="center" valign="middle" >Q 3 = M 2</td></tr><tr><td align="center" valign="middle" >4</td><td align="center" valign="middle" >M 4 = r 3</td><td align="center" valign="middle" >q 4</td><td align="center" valign="middle" >r 4</td><td align="center" valign="middle" >Q 4 = M 3</td></tr><tr><td align="center" valign="middle" >5</td><td align="center" valign="middle" >M 5 = r 4</td><td align="center" valign="middle" >q 5</td><td align="center" valign="middle" >r 5</td><td align="center" valign="middle" >Q 5 = M 4</td></tr><tr><td align="center" valign="middle" >6</td><td align="center" valign="middle" >M 6 = r 5</td><td align="center" valign="middle" >q 6</td><td align="center" valign="middle" >r 6</td><td align="center" valign="middle" >Q 6 = M 5</td></tr><tr><td align="center" valign="middle" >7</td><td align="center" valign="middle" >M 7 = r 6</td><td align="center" valign="middle" >q 7</td><td align="center" valign="middle" >r 7</td><td align="center" valign="middle" >Q 7 = M 6</td></tr></tbody></table></table-wrap><p>Then we compute</p><p>X b i = [ 1 0 0 0 1 1 1 1 1 1 0 1 1 0 0 1 ] [ b 0 b 1 b 2 b 3 ] = [ b 0 b 0 + b 1 b 0 + b 1 + b 2 b 0 + b 1 + b 2 + b 3 ] (14)</p><p>Y b j = [ 1 1 0 1 1 1 1 1 0 0 0 0 1 1 0 1 ] [ b 4 b 5 b 6 b 7 ] = [ b 7 + b 6 + b 5 + b 4 b 7 + b 6 + b 5 b 7 + b 6 b 7 ] (15)</p><p>Y b i = [ 1 1 0 1 1 1 1 1 0 0 0 0 1 1 0 1 ] [ b 0 b 1 b 2 b 3 ] = [ b 3 + b 2 + b 1 + b 0 b 3 + b 2 + b 1 b 3 + b 2 b 3 ] (16)</p><p>X b j = [ 1 0 0 0 1 1 1 1 1 1 0 1 1 0 0 1 ] [ b 4 b 5 b 6 b 7 ] = [ b 4 b 4 + b 5 b 4 + b 5 + b 6 b 4 + b 5 + b 6 + b 7 ] (17)</p><p>X b i + Y b j = [ b 0 b 0 + b 1 b 0 + b 1 + b 2 b 0 + b 1 + b 2 + b 3 ] + [ b 7 + b 6 + b 5 + b 4 b 7 + b 6 + b 5 b 7 + b 6 b 7 ] = [ b 0 + b 7 + b 6 + b 5 + b 4 b 0 + b 1 + b 7 + b 6 + b 5 b 0 + b 1 + b 2 + b 7 + b 6 b 0 + b 1 + b 2 + b 3 + b 7 ] (18)</p><p>Y b i + X b j = [ b 3 + b 2 + b 1 + b 0 b 3 + b 2 + b 1 b 3 + b 2 b 3 ] + [ b 4 b 4 + b 5 b 4 + b 5 + b 6 b 4 + b 5 + b 6 + b 7 ] = [ b 3 + b 2 + b 1 + b 0 + b 4 b 3 + b 2 + b 1 + b 4 + b 5 b 3 + b 2 + b 4 + b 5 + b 6 b 3 + b 4 + b 5 + b 6 + b 7 ] (19)</p><p>The result is</p><p>[ e 0 e 1 e 2 e 3 e 4 e 5 e 6 e 7 ] = [ b 0 + b 7 + b 6 + b 5 + b 4 b 0 + b 1 + b 7 + b 6 + b 5 b 0 + b 1 + b 2 + b 7 + b 6 b 0 + b 1 + b 2 + b 3 + b 7 b 3 + b 2 + b 1 + b 0 + b 4 b 3 + b 2 + b 1 + b 4 + b 5 b 3 + b 2 + b 4 + b 5 + b 6 b 3 + b 4 + b 5 + b 6 + b 7 ] (20)</p><p>and this satisfies:</p><p>e i = b i + b ( i + 4 ) mod ( 8 ) + b ( i + 5 ) mod ( 8 ) + b ( i + 6 ) mod ( 8 ) + b ( i + 7 ) mod ( 8 ) ,     0 ≤ i ≤ 7 (21)</p><p>At the last, to find ( c 7 c 6 c 5 c 4 c 3 c 2 c 1 c 0 ) , we add ( e 7 e 6 e 5 e 4 e 3 e 2 e 1 e 0 ) to 01100011 .</p></sec><sec id="s3"><title>3. Results</title><p>The matrices: X b i , Y b j , Y b i and X b j are just ( b 7 b 6 b 5 b 4 b 3 b 2 b 1 b 0 ) with some XOR operations. When multiplying X by b i or b j , the result will be:</p><p>(first element, first + second, first + second + third, first + second + third+ fourth) of b i or b j , and when multiplying Y by b i or b j , starting from the fourth element, the result will be:</p><p>(First + second + third + fourth, second + third + fourth, third + fourth, fourth) of b i or b j .</p><p>So, we can find ( e 7 e 6 e 5 e 4 e 3 e 2 e 1 e 0 ) from ( b 7 b 6 b 5 b 4 b 3 b 2 b 1 b 0 ) directly.</p></sec><sec id="s4"><title>4. Example</title><p>To encrypt:</p><p>Input: 32 43 F6 A8 88 5A 30 8D 31 31 98 A2 E0 37 07 34</p><p>Key: 2B 7E 15 16 28 AE D2 A6 AB F7 15 88 09 CF 4F 3C</p><p>using AES [<xref ref-type="bibr" rid="scirp.91453-ref1">1</xref>] .</p><p>Let us do the first step (Rijndael ByteSub transformation).</p><p>[ 32 88 31 E 0 43 F 6 A 8 5 A 30 8 D 31 98 A 2 37 07 34 ] + [ 2 B 28 A B 09 7 E 15 16 A E D 2 A 6 F 7 15 88 C F 4 F 3 C ] = [ 19 .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. ]</p><p>We just transform the element {19},</p><p>19 = 00011001 = x 4 + x 3 + 1</p><p>Computing the multiplicative inverse, (look at <xref ref-type="table" rid="table3">Table 3</xref>).</p><p>Since r 2 = 1 ,</p><p>T = T 2 = q 2 T 1 + T 0 = x ( x 4 + x 3 + x 2 + x + 1 ) + 1 = x 5 + x 4 + x 3 + x 2 + x + 1 = 00111111</p><p>Now, we take ( 00111111 ) , to do the second operation.</p><p>[ 1 1 1 1 1 1 0 0 ] → [ 1 0 1 0 ] + [ 0 1 0 0 ] [ 0 1 0 1 ] + [ 1 0 0 0 ] → [ 1 1 1 0 1 1 0 1 ]</p><p>Then we add the result to ( 01100011 )</p><table-wrap id="table3" ><label><xref ref-type="table" rid="table3">Table 3</xref></label><caption><title> Steps finish when r 2 = 1 </title></caption><table><tbody><thead><tr><th align="center" valign="middle" >i</th><th align="center" valign="middle" >M</th><th align="center" valign="middle" >q</th><th align="center" valign="middle" >r</th><th align="center" valign="middle" >Q</th></tr></thead><tr><td align="center" valign="middle" >1</td><td align="center" valign="middle" >x 4 + x 3 + 1</td><td align="center" valign="middle" >x 4 + x 3 + x 2 + x + 1</td><td align="center" valign="middle" >x 3 + x 2 + 1</td><td align="center" valign="middle" >x 8 + x 4 + x 3 + x</td></tr><tr><td align="center" valign="middle" >2</td><td align="center" valign="middle" >x 3 + x 2</td><td align="center" valign="middle" >x</td><td align="center" valign="middle" >1</td><td align="center" valign="middle" >x 4 + x 3 + 1</td></tr></tbody></table></table-wrap><p>[ 1 1 1 0 1 1 0 1 ] + [ 1 1 0 0 0 1 1 0 ] = [ 0 0 1 0 1 0 1 1 ]</p><p>So,</p><p>19 → 11010100 = D 4</p></sec><sec id="s5"><title>5. Conclusion</title><p>The modern technique proposed in this work equivalently finds the Rijndael byte substitute transformation without a need to compute multiplicative inverses and matrices multiplication by traditional methods.</p></sec><sec id="s6"><title>Conflicts of Interest</title><p>The author declares no conflicts of interest regarding the publication of this paper.</p></sec><sec id="s7"><title>Cite this paper</title><p>Ahmed, W.E. (2019) On Rijndael ByteSub Transformation. Applied Mathematics, 10, 113-118. https://doi.org/10.4236/am.2019.103010</p></sec></body><back><ref-list><title>References</title><ref id="scirp.91453-ref1"><label>1</label><mixed-citation publication-type="other" xlink:type="simple">Advanced Encryption Standard (AES), FIPS Publication 197, National Institute of Standards and Technology (NIST), November 26, 2001.</mixed-citation></ref><ref id="scirp.91453-ref2"><label>2</label><mixed-citation publication-type="other" xlink:type="simple">Menezes, A., van Oorschot, P. and Vanstone, S. (1997) Handbook of Applied Cryptography. CRC Press, New York.</mixed-citation></ref><ref id="scirp.91453-ref3"><label>3</label><mixed-citation publication-type="other" xlink:type="simple">Ahmed, W. (2019) Some Techniques to Compute Multiplicative Inverses for Advanced Encryption Standard. Journal of Advances in Mathematics, 16, 8208-8212.  
&lt;/br&gt;https://doi.org/10.24297/jam.v16i0.8016</mixed-citation></ref></ref-list></back></article>