0% found this document useful (0 votes)
18 views117 pages

Cryptography PART 2

The document discusses cryptography, focusing on symmetric key algorithms, particularly block ciphers and their properties, including confusion and diffusion. It explains the differences between block and stream ciphers, the implementation of block ciphers, and the significance of the Data Encryption Standard (DES) and its vulnerabilities. Additionally, it covers various modes of operation for encryption, such as ECB, CBC, OFB, CFB, and CTR, along with mathematical foundations relevant to cryptography.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views117 pages

Cryptography PART 2

The document discusses cryptography, focusing on symmetric key algorithms, particularly block ciphers and their properties, including confusion and diffusion. It explains the differences between block and stream ciphers, the implementation of block ciphers, and the significance of the Data Encryption Standard (DES) and its vulnerabilities. Additionally, it covers various modes of operation for encryption, such as ECB, CBC, OFB, CFB, and CTR, along with mathematical foundations relevant to cryptography.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 117

Cryptography

BLOCK CIPHERS

⚫ Types of symmetric key algorithms


– Block Ciphers: Manipulates blocks of data. Say 64 or 128
bits at a time.
– Stream Ciphers: Manipulates streams of data, typically one
bit at a time

Block cipher
Block Ciphers Vs Stream Ciphers

⚫ Stream ciphers
– Faster Encryption
– Low error Propagation
– Low Diffusion
⚫ Block Ciphers
– Slow Encryption
– High error propagation
– High diffusion
Properties of Block Ciphers

⚫ Correctness
– For a given key, one-to-one mapping between plaintext and
ciphertext
⚫ Two or more plain text cannot map to the same cipher text
⚫ The same plain text can not be mapped to two or more ciphertext
⚫ Efficiency: Encryption and Decryption time should be
in Polynomial time
⚫ Secure: Encryption should satisfy, mapping between
input and output generated by a Random permutation
– One-bit change in the input, half output bits should be changed
Implementation Block ciphers

⚫ Confusion via S-box


⚫ Diffusion via P-Box
⚫ Many rounds
⚫ Fast and easy to implement
⚫ Efficient to reverse
– Same code and hardware should be used for both encryption
and decryption
Secret-key or symmetric encryption

⚫ Ke = Kd .
⚫ Algorithms are fast and suitable for software and
hardware implementations.
⚫ The common key has to be agreed upon by Alice and
Bob before the actual communication.
⚫ Each pair of communicating parties needs a secret
key.
⚫ If there are many communicating pairs, the key
storage requirement is high.
Contd…

Q: how do Bob and Alice agree on key value?


⚫ Diffie-Hellman Symmetric Key Exchange Protocol,
Public key crypto
⚫ Offline methods
Public-key or asymmetric encryption
⚫ Ke ≠ Kd .
⚫ Introduced by Rivest, Shamir and Adleman (1978).
⚫ Ke is the public key known to everybody (even to enemies).
⚫ Kd is the private key to be kept secret.
⚫ It is difficult to compute Kd from Ke.
⚫ Anybody can send messages to anybody. Only the proper
recipient can decrypt.
⚫ No need to establish keys a priori.
⚫ Each party requires only one key-pair for communicating with
everybody.
⚫ Algorithms are slow, in general.
Substitution cipher Vs Transposition
cipher

⚫ Substitution cipher
– Changes its identity but retains its position
– Simple process and easy to crack the code
– Ex: cease cipher
⚫ Transposition cipher
– Changes its position, but retains its identity
– Complex and difficult to crack
– Ex: Columnar transposition ciphers
Components used in Block ciphers
Confusion:
– The relationship between the key and ciphertext is obscured
⚫ A common element for achieving confusion is substitution
⚫ The property of confusion hides the relationship between the ciphertext
and the key
⚫ SBOX: It is a key-less fixed substitution cipher
Diffusion:
Influence of one each plain text bit spread over many cipher text
bits
– if we change a single bit of the plaintext, then (statistically) half of the bits in the
ciphertext should change,
– Similarly, if we change one bit of the ciphertext, then approximately one-half of the
plaintext bits should change
– PBOX: It is a key-less fixed transposition cipher
Feistel Cipher
⚫ Feistel cipher refers to a type of block cipher design,
not a specific cipher
⚫ Split plaintext block into left and right halves:
Plaintext = (L0,R0)
⚫ For each round i=1,2,...,n, compute
Li= Ri−1
Ri= Li−1  F(Ri−1,Ki)
where F is round function and Ki is subkey
⚫ Ciphertext = (Ln,Rn)
The parameters and design
features of Feistel network
⚫ Block size:
– Larger block sizes mean greater security but reduced
encryption/decryption speed for a given algorithm.
– Traditionally, a block size of 64 bits
⚫ Key size:
– Larger key size means greater security but may decrease
encryption/decryption speed
– Key sizes of 64 bits or less are now widely considered to be inadequate.
128 bits has become a common size
⚫ Number of rounds:
– A single round offers inadequate security but multiple rounds offer
increased security. A typical size is 16 rounds
Contd…
⚫ Rounds: Ensure each plain text input bit affects most
ciphertext output bits
– Diffuses better
– Only one round will change one-bit change
Contd…
⚫ Subkey generation algorithm:
– Greater complexity in this algorithm should lead to greater
difficulty of cryptanalysis
⚫ Round function F:
– Greater complexity generally means greater resistance to
cryptanalysis.
⚫ Fast software encryption/decryption:
– In many cases, encryption is embedded in applications in
such a way as to preclude a hardware implementation
⚫ Ease of analysis:
– make our algorithm as difficult as possible to cryptanalysis.
Data Encryption Standard
⚫ DES is the most widely used encryption scheme, adopted in
1977
⚫ National Bureau of Standards, now
⚫ National Institute of Standards and Technology (NIST)

⚫ Features:
– Block size = 64 bits
– Key size = 56 bits (in reality, 64 bits)
– Number of rounds = 16
– 16 intermediary keys, each 48 bits
General Depiction
of DES Encryption
Algorithm
The details
of one round
of DES
Initial Permutation (IP)

⚫Thistable specifies the input permutation on a 64-bit block.


⚫The meaning is as follows:
⚫The first bit of the output is taken from the 58th bit of the input;
⚫ The second bit from 50th bit, and so on, with the last bit of the output
taken from the 7th bit of the input.
Final Permutation (IP-1)

⚫ The final permutation is the inverse of the initial


permutation
Expansion function

⚫ E is an expansion function which takes a block of 32


bits as input and produces a block of 48 bits as output

16 bits appear twice,


in the expansion
S-boxes

⚫ The S-Boxes do the real mixing (Confusion). DES


uses 8-Boxes, each with a 6 Bit input and 4 bit output
S-Box rule

Input S-Box-1 is 100011

Ans: Row-3
Column-1
Value is 12

Output: 1100
S-boxes
Key generation

⚫ In rounds i = 1,2,9, 16,


the two halves are
rotated left by one bit
⚫ i = 1,2,9, 16, the two
halves are rotated left
by two bits
Permuted Choice 1

⚫ In the DES specification, the key length is 64 bit


Permuted Choice 2
DES Decryption
⚫ The same algorithm as
encryption.
⚫ Reversed the order of key
(Key16, Key15, … Key1).
⚫ For example:
– IP undoes IP-1 step of
encryption.
– 1st round with SK16
undoes 16th encrypt round.
Security of DES
⚫ Two major criticisms against the cryptographic
strength of DES
– The key space is too small, i.e., the algorithm is vulnerable
against brute-force attacks
– The design criteria of the S-boxes was kept secret and there
might have existed an analytical attack that exploits
mathematical properties of the S-boxes, but which is only
known to the DES designers
Crypt analysis Attacks
⚫ Brute Force or Exhaustive key search:
– Try all 256 possible keys
– In 1977, Whitfield Diffie and Martin Hellman estimated that
it was possible to build an exhaustive key search machine
for approximately $20,000,000
– CRYPTO 1993 conference, estimated the cost of his design
– at approximately $1,000,000, and the time required to find
the key at 1.5 days
Contd…
⚫ In 1998, EFF (Electronic Frontier Foundation) built
the hardware machine Deep Crack
Contd…

⚫ In 2006, the COPACOBANA (Cost-Optimized Parallel


Code-Breaker) machine was built based on commercial
integrated circuits
⚫ DES with an average search time of less than 7 days
Use of DES

⚫ Single DES should only be used for applications


where only short-term security is needed—say, a few
hours—or where the value of the encrypted data is
very low
Analytical Attacks
⚫ In year 1990, Eli Biham and Adi Shamir discovered
what is called differential cryptanalysis (DC)
⚫ DES S-boxes are particularly resistant against this
attack
History of full-round DES attacks
MULTIPLE ENCRYPTION AND
TRIPLE DES
⚫ Strengthening DES to avoid Exhaustive Search: 3DES
Lessons Learned

⚫ DES was the dominant symmetric encryption


algorithm from the mid-1970s to the mid-1990s.
– Since 56-bit keys are no longer secure, the Advanced
Encryption Standard (AES) was created
⚫ Standard DES with 56-bit key length can be broken
relatively easily nowadays through an exhaustive key
search
⚫ DES is quite robust against known analytical attacks:
In practice it is very difficult to break the cipher with
differential or linear cryptanalysis
Contd…

⚫ triple DES (3DES) is created, against which no


practical attack is currently known
⚫ The “default” symmetric cipher is nowadays often
AES.
DES modes of operation

⚫ A mode of operation describes the process of


encrypting each of these blocks under a single key
Terminology
⚫ Initialize Vector (IV)
– A block of bits to randomize the encryption and hence produce distinct
ciphertext
⚫ Nonce: Number (used) Once
– Random of the pseudorandom number to ensure that past
communications can not be reused in replay attacks
– Some also refer to initialize vector as a nonce
⚫ Padding
– The final block may require padding to fit a block size
⚫ Method
– Add null Bytes, Add 0x80 and many 0x00. Add the n bytes with value n
Electronic Codebook Book (ECB)

⚫ Message is broken into independent blocks which are


encrypted
⚫ Each block is a value which is substituted, like a
codebook, hence name
⚫ Each block is encoded independently of the other
blocks
Ci = EK (Pi)
⚫ Uses: secure transmission of single values
ECB Scheme

⚫ Each block is encrypted separately


⚫ Block synchronization between the encryption and
decryption parties Alice and Bob is not necessary
Remarks on ECB

⚫ Strength: it’s simple.


⚫ Weakness:
– Identical plaintexts are mapped to identical ciphertexts.
– If the same message is encrypted (with the same key) and
sent twice, their ciphertext are the same.
⚫ Typical application:
– secure transmission of short pieces of information (e.g. a
temporary encryption key)
Example image
Cipher Block Chaining (CBC)
⚫ Two main ideas
– The encryption of all blocks is “chained together”
– The encryption is randomized by using an initialization vector
(IV)
⚫ IV is random each time and transmitted along with cipher text
⚫ Uses: bulk data encryption, authentication
Contd…
Initial Vector (IV)

⚫ If we choose a new IV every time we encrypt, the


CBC mode becomes a probabilistic encryption scheme
⚫ Note that we do not have to keep the IV secret
⚫ IV to be a nonce, i.e., a number used only once
⚫ IV communication ways:
– Randomly chosen number is transmitted to Alice and Bob,
next increment the values
– It could be derived from values such as Alice’s and Bob’s ID
number, e.g., their IP addresses, together with the current
time
Remarks on CBC

⚫ The encryption of a block depends on the current and


all blocks before it.
⚫ So, repeated plaintext blocks are encrypted differently.
⚫ Initialization Vector (IV)
– May sent encrypted in ECB mode before the rest of
ciphertext
Output FeedBack (OFB)

⚫ Is used to build a stream cipher encryption scheme


Remarks on OFB

⚫ Each bit in the ciphertext is independent of the


previous bit or bits. This avoids error propagation

⚫ Security issue
– when jth plaintext is known, the jth output of the forward cipher
function will be known
– Easily cover jth plaintext block of other message with the same IV
⚫ Require that the IV is a nonce
Cipher FeedBack (CFB)

⚫ Uses a block cipher as a building block for a stream


cipher
⚫ It is similar to the OFB mode but instead of feeding
back the output of the block cipher, the ciphertext is
fed back
Contd…
Remark on CFB

⚫ A ciphertext segment depends on the current and all


preceding plaintext segments.

⚫ A corrupted ciphertext segment during transmission


will affect the current and next several plaintext
segments.
CFB V.S. OFB

Cipher Feedback Output Feedback


Counter (CTR)
⚫ The input to the block cipher is a counter which
assumes a different value every time the block cipher
computes a new key stream block
Key points

⚫ One attractive feature of the Counter mode is that it


can be parallelized because, unlike the OFB or CFB
mode
⚫ Applications with high throughput demands
– in networks with data rates in the range of Gigabits per
second
CTR Encryption and Decryption
Comparison of Different Modes
Contd…
To be explored

⚫ Cryptanalysis of DES algorithm


⚫ Any new Padding techniques
⚫ How do we specify the actual mode used for
Encryption and Decryption in Real-time
Recap

I
W
N
Mathematical Background
⚫ Will focus on these two topics
– Abstract Algebra
– Number Theory
⚫ Cryptography requires sets of integers and specific
operations that are defined for those sets
⚫ The combination of the set and the operations that are
applied to the elements of the set is called an algebraic
structure
Contd…

⚫ Abstract Algebra
– Group {G, .}
– Ring {R, +, *}
– Field {F, +, *, multiplicative inverse}
⚫ These are three different sets with different operations
⚫ Classification of each set, depends on the Axioms it satisfies
Definitions

⚫ Set
– Is a distinct collection of well-defined objects
– Example:
⚫ N={1,2,3…..N}
– Set of natural numbers
Group (G, *)
⚫ A Group(G, *) Is a nonempty set G together with a binary
operation (*) on G that the following condition hold:
– Closure: For all a, b 𝜖 G, the elements a+b 𝜖 G
– Inverse: Each element in G has a inverse i.e. ∀a 𝜖G ,
a+a-1=a-1+a=0
– Associativity: For a, b, c 𝜖 G, we have

a+(b+c)=(a+b)+c
– Identity: there exist identity elements e 𝜖 G such that,
∀a 𝜖G, a+e= e+a=a
Contd…
Example:
– A set of Natural numbers (N, +) is not a group, as it does not
satisfy the Inverse Ex: 3+ (-3)=0, but (-3) does not belong to I
– A set of Integers (I, *) is not a group, as it does not satisfy
Identity 3*1/3= 1, but 1/3 does not belong to I
– A set of Rational numbers (Q, +) is a Group
Abelian Group
⚫ Conditions are
– It should be a group and should satisfy (Closure,
Associative, Identity, and Inverse)
– Commutative Property
⚫ ∀ a,b 𝜖 G, a*b=b*a
⚫ Eexample (R,+) is an Abelian Group
⚫ (R,*) is an Abelian Group
Ring (+, *)
⚫ It consists of a set equipped with two binary operations that
generalize the arithmetic operations of additions and
multiplications
⚫ Ring can also be a group with additional features
Multiplication:
Addition:( +)
⚫Closure: a.b 𝜖 G
⚫Closure: a+b 𝜖 G
⚫Inverse: Each has an additive inverse
⚫Inverse: Each has an additive inverse
⚫ Associativity: a.(b.c)=(a.b).c
⚫ Associativity: a+(b+c)=(a+b)+c
⚫ Distributive property:
⚫ Identity: a+0= a
a.(b+c)=a.b+a.c, (a+b).c=a.c+b.c
⚫ Integers, Real numbers, and Complex numbers are Ring
Fields (+,*)
⚫ Field (F, +,*) is a set of elements with two binary operations
such as Addition and Multiplication and the following Axioms
are satisfied: ( if a, b, c are elements of F)
For Addition operation For Multiplication
1 Closure 6 Closure 11 No zero divisor
2 Associative 7 Associative
3 Additive Identity 8 Multiplicative identity
4 Additive inverse 9 Distributive 12 Multiplicative
5Commutative 10 Commutative inverse
A1-A4 is Group,
A1-A5 &M6-M9 is
A1-A5 is Abilian Group
Commutative Ring A1-A5 &M6-M11 is A1-A5 &M6-M12 is
A1-A5 &M6-M8 Field
Integral Domain
Properties of Groups, Rings, and Fields
Modular Arithmetic

⚫ Let (a) be an integer and (n) be a positive integer,


then if we divide a by n, will get a quotient (q) and
reminder ( r), 0≤r<n
⚫ a= qn+r
⚫ r is the reminder called the residuo or a mod n
⚫ 11 mod 7= 4
⚫ -11 mod 7= 3
– We can write (-11) as -2*7+3
Questions

⚫ Set of elements in Rational number is Field or not


⚫ Is the set of all elements in z/2 a field or not?
Finite field

⚫ if the order of the field is finite


⚫ Galois showed that for a field to be finite, the number
of elements should be pm, where p is a prime and m is
a positive integer.
⚫ Finite fields for only PM elements where p is prime and
m is a positive integer
– GF(2)=GF(21)= {0,1} + 0 1 * 0 1
0 0 1 0 0 0
– GF (5)= GF(51) ={0,1,2,3,4}
1 1 0 1 0 1
– GF(81) =GF(34) ={0 1 2}
– GF(256)=GF (28)
Prime field and extension field

⚫ Pn , where n=1 is called as Prime field


⚫ pn , where n>1 is called an extension field
⚫ Example:
⚫ (21) is a prime field
⚫ (28) is extension field
Polynomials
⚫ Poly means many and nominal means terms,
⚫ it has many terms
⚫ A polynomial of degree n − 1 is an expression of the form

where xi is called the ith term and ai is called the


coefficient of the ith term.
⚫We can represent the 8-bit word (10011001) using a
polynomial
⚫x7+ x4+ x3+1
Advantages of Polynomial
Representation
⚫ Arithmetic Operations:
– Polynomial arithmetic is simple, leveraging XOR and shift
operations for addition and multiplication.
⚫ Implementation in Hardware/Software:
– Polynomial-based algorithms are computationally efficient
and widely supported.
⚫ Logical Compatibility:
– Bit-level representation aligns well with the binary nature of
digital systems.
Addition- Example-1

⚫ Let us do (x5+x2+x) (x3+x2+1) in GF(28).


Addition and Subtraction

⚫ Sum C(x)=A(x)+B(x) of two elements from GF(28) is


computed:
A(x) =x7+ x6+ x4+ 1
B(x) = x4+ x2+ 1
C(x) = x7+ x6+ x2

Note: if we computed the difference of the two


polynomials A(x)−B(x) from the example above, we
would get the same result as for the sum
Multiplication
Important points

⚫ GF(2n) order of polynomial will never exceed n-1


⚫ If, after some operation, the order exceeds n-1, then
perform division with an order of n irreducible
polynomial
⚫ Irreducible polynomial
– You can not represent the product of two different
polynomials
Irreducible polynomial

⚫ in finite field operations, is a polynomial that cannot


be factored into the product of two non-constant
polynomials over the same field.
Example:

⚫ Find the result of (x5+x2+x)*(x7+x4+x3+x2+x) in


GF(28) with irreducible polynomial (x8+x4+x3+x+1)
Irreducible polynomial
Degree 2 x^2 + x^1 + 1
Degree 3 x^3 + x^1 + 1
Degree 4 x^4 + x^1 + 1
Degree 5 x^5 + x^2 + 1
x^5 + x^4 + x^2 + x^1 + 1
x^5 + x^4 + x^3 + x^2 + 1
Degree 6 x^6 + x^1 + 1
x^6 + x^5 + x^2 + x^1 + 1
x^6 + x^5 + x^3 + x^2 + 1
Degree 8 x^8 + x^4 + x^3 + x+ 1
x^8 + x^5 + x^3 + x^1 + 1
x^8 + x^6 + x^4 + x^3 + x^2 + x^1 + 1
x^8 + x^6 + x^5 + x^1 + 1
x^8 + x^6 + x^5 + x^2 + 1
x^8 + x^6 + x^5 + x^3 + 1
x^8 + x^7 + x^6 + x^1 + 1
x^8 + x^7 + x^6 + x^5 + x^2 + x^1 + 1
Irreducible polynomial
Inversion in GF(2m)

⚫ Inversion in GF(28) is the core operation of the Byte


Substitution transformation, which contains the AES
S-Boxes
⚫ A−1(x) *A(x) =1 mod P(x)
Advance Encryption Standard (AES)

⚫ In year 2000, NIST


announced that it had
chosen Rijndael as the AES
⚫ Rijndael, by Joan Daemen
and Vincent Rijmen
Basic Structure
Applications

⚫ Internet security standard IPsec, TLS,


⚫ Wi-Fi encryption
⚫ standard IEEE 802.11i,
⚫ Secure shell network protocol SSH (Secure Shell)
AES
4 Transformations
⚫ Byte substitution,
⚫ ShiftRows,
⚫ MixColumns,
⚫ AddRoundKey,
3 Transformations
⚫ Byte substitution
⚫ ShiftRows,
⚫ AddRoundKey,
AES Encryption
and Decryption
Important points:

⚫ Is not a Feistel structure (half of the data block is used to modify


the other half of the data block and then the halves are swapped)
⚫ AES instead processes the entire data block as a single
matrix during each round using substitutions and
permutation
⚫ The key that is provided as input is expanded into an
array forty-four 32-bit words, w[i].
Operations:
Four different stages are used, one of permutation and
three of substitution:
– Substitute bytes: Uses an S-box to perform a byte-by-byte
substitution of the block.
– ShiftRows: A simple permutation.
– MixColumns: A substitution that makes use of arithmetic
over GF(28).
– AddRoundKey: A simple bitwise XOR of the current block
with a portion of the expanded key.
Contd…

⚫ Basic ops for a round:


– Substitution – byte level (confusion)
– Shift row (transposition) – depends on key length (diff.)
– Mix columns – LSH and XOR (confusion +diffusion)
– Add subkey – XOR used (confusion)
AES Encryption Round
Substitute Bytes Transformation
S-Box

⚫Left bits determine the row, right bits determine the


column
Example:
Shift row transformation

⚫ The first row of states is not altered.


⚫ The second row is shifted 1 bytes to the left in a circular
manner.
⚫ The third row is shifted 2 bytes to the left in a circular manner.
⚫ The fourth row is shifted 3 bytes to the left in a circular
Example
MixColumn Sublayer
⚫ The MixColumn step is a linear transformation which
mixes each column of the state matrix
⚫ MixColumn(B) =C,
⚫ Each 4-byte column is considered as a vector and
multiplied by a fixed 4×4 matrix.
⚫ The matrix contains constant entries
⚫ Multiplication and addition of the coefficients is done
in GF(28)
Contd…

⚫The second column of output bytes (C ,C ,C ,C ) is computed by


4 5 6 7

multiplying the four input bytes (B ,B ,B ,B ) by the same constant


4 9 14 3

matrix
⚫ C0=(02*B0)+(03*B5)+(01*B10)+(01*B15)
⚫ C1=(01*B0)+(02*B5)+(03*B10)+(01*B15)
⚫ C2=(01*B0)+(01*B5)+(02*B10)+(03*B15)
⚫C3=(03*B0)+(01*B5)+(01*B10)+(02*B15)
Contd…

Finite Field Multiplication


Similar terms will be cancelled
Contd…

⚫ (02 • 87) ⊕ (03 • 6E) ⊕ 46 ⊕ A6 = 47


⚫ So to show this is the case we can represent each Hex
number by a polynomial:
– {02} = x
– {87} = x7 + x2 + x + 1
– Multiply these two together and we get: x • (x7 + x2 + x + 1)
= x8 + x3 + x2 + x
⚫ The degree of this result is greater than 7 so we have to
reduce it modulo an irreducible polynomial m(x). The
designers of AES chose m(x) = x8 + x4 + x3+ x + 1.
Key generation

⚫ The AES key expansion algorithm


– Takes as input a four-word (16-byte) key and
– Produces a linear array of 44 words (176 bytes)
– Initial round four words and 10 rounds each four words
Left shift

Substitute bytes
⚫ W8= W4 Ex-OR G(W3)
⚫ W9 = W8 Ex-OR W5
⚫ W10 = W9 Ex-OR W6
⚫ W11 = W10 Ex-OR W7
Example

D R E A M B I G W O R K H A R D
68 82 69 65 77 66 73 71 87 79 82 75 72 65 82 68
68 77 87 72

82 66 79 65

69 73 82 82

65 71 75 68

W0 W1 W2 W3
Function (g)

⚫RotWord performs a one-byte circular left shift on a


word (This means that an input word [B0, B1, B2, B3] is transformed into [B1,
B2, B3, B0].)
⚫ SubWord performs a byte substitution on each byte of
its input word, using the S-box
⚫ The result of steps 1 and 2 is XORed with a round
constant, Rcon[j].
Mathematical description of the S-
Box

⚫ S-boxes have a strong algebraic structure


⚫ AES S-Box can be viewed as a two-step mathematical
transformation


Decryption
AES decryption round function
Properties of Modular Arithmetic

⚫ a mod n is the remainder when n divides a,


the reminders can be {0,1,2,3…..(n-1)}
⚫ Modular arithmetic exhibits the following properties:
– [(a mod n) + (b mod n)] mod n = (a + b) mod n
– [(a mod n) - (b mod n)] mod n = (a - b) mod n
– [(a mod n) * (b mod n)] mod n = (a * b) mod n
Example:
11 mod 8 = 3; 15 mod 8 = 7
Adiition:
– [(11 mod 8) + (15 mod 8)] mod 8 = 10 mod 8 = 2
– (11 + 15) mod 8 = 26 mod 8 = 2
Subtraction
– [(11 mod 8) - (15 mod 8)] mod 8 = -4 mod 8 = 4
– (11 - 15) mod 8 = -4 mod 8 = 4
Multiplication
– [(11 mod 8) * (15 mod 8)] mod 8 = 21 mod 8 = 5
– (11 * 15) mod 8 = 165 mod 8 = 5
Arithmetic Modulo 8

a+e=a
e is an additive identity
mod 8 additive element is 0
Multiplication modulo 8

⚫ Multiplicative identity for


1, 3,5, and 7

⚫ Conclusion:
⚫ a is relative prime to n, then multiplicative inverse exist
Additive and multiplicative inverse
of mod 8
a Additive Multiplicative
inverse Inverse
0 0 -----
1 7 1
2 6 ----
3 5 3
4 4 ----
5 3 5
6 2 -----
7 1 7
Z7

Addition mod 7 Multiplication mod 7


+ 0 1 2 3 4 5 6 * 0 1 2 3 4 5 6
0 0 1 2 3 4 5 6 0 0 0 0 0 0 0 0
1 1 2 3 4 5 6 0 1 0 1 2 3 4 5 6
2 2 3 4 5 6 0 1 2 0 2 4 6 1 3 5
3 3 4 5 6 0 1 2 3 0 3 6 2 5 1 4
4 4 5 6 0 1 2 3 4 0 4 1 5 2 6 3
5 5 6 0 1 2 3 4 5 0 5 3 1 6 4 2
6 6 0 1 2 3 4 5 6 0 6 5 4 3 2 1

⚫ For each element of z7 multiplicative


inverse exists except Zero
⚫ With addition and multiplication zp (mod p) is a Field
Example

⚫ We can define GF(5) on the set Z5(5 is a prime)with


addition and multiplication operators

You might also like