CNS Unit-2 Notes
CNS Unit-2 Notes
Groups
A group G , sometimes denoted by {G,*} ,is a set of elements with a binary
operation denoted by * that associates to each ordered pair (a,b) of elements G in an
element(a*b) in , such that the following axioms are obeyed:
1
Rings
A ring R, sometimes denoted by {R, +, X}, is a set of elements with two binary
operations, called addition and multiplication, such that for all a, b, c ,in R the following
axioms are obeyed
Next, we define an integral domain, which is a commutative ring that obeys the following
axioms
Fields
A field F, sometimes denoted by {F, +, X}, is a set of elements with two binary
operations, called addition and subtraction, such that for all a, b, c , in F the following
axioms are obeyed
2
Figure 2.2 Groups, Ring and Field
3
Modular Arithmetic Operations
A kind of integer arithmetic that reduces all numbers to one of a fixed set [0,….,n-1] for
some number n. Any integer outside this range is reduced to one in this range by taking
the remainder after division by n.
Modular arithmetic exhibits the following properties
Example 3:
gcd (1970, 1066) = gcd (1066, 1970 mod 1066)
=gcd (1066, 904)
=gcd (904, 1066 mod 904)
=gcd (904, 162)
=gcd (162, 904 mod 162)
=gcd (162, 94)
=gcd (94, 162 mod 94)
=gcd (94, 68)
=gcd (68, 94 mod 68)
=gcd (68, 26)
=gcd (26, 68 mod 26)
=gcd (26, 16)
=gcd (16, 26 mod 16)
=gcd (16, 10)
=gcd (10, 16 mod 10)
=gcd (10, 6)
=gcd (6, 10 mod 6)
=gcd (6, 4)
=gcd (4, 6 mod 4)
=gcd (4, 2)
=gcd (2, 4 mod 2)
=gcd (2, 0)
Properties of Congruences
Congruences have the following properties:
Matrices
Matrix is a rectangular array in mathematics, arranged in rows and columns
of numbers, symbols or expressions.
A matrix will be represented with their dimensions as l x m where l defines the row
and m defines the columns
Examples of Matrices
1. Row Matrix
2. Column Matrix
3. Square Matrix
4. Zero Matrixes
5. Identity Matrix
Let us now consider polynomials in which the coefficients are elements of some
field F; we refer to this as a polynomial over the field F. In that case, it is easy to show that
the set of such polynomials is a ring, referred to as a polynomial ring. That is, if we
consider each distinct polynomial to be an element of the set, then that set is a ring 8
when polynomial arithmetic is performed on polynomials over a field, then division is
possible. Note that this does not mean that exact division is possible. Let us clarify this
distinction. Within a field, given two elements and, the quotient is also an element of the
field. However, given a ring that is not a field, in Ra /b ba Zp
Figure 2.3 Examples of Polynomial Arithmetic
A polynomial over a field is called irreducible if and only if cannot be expressed as
a product of two polynomials, both over, and both of degree lower than that of. By analogy
to integers, an irreducible polynomial is also called a prime polynomial.
The overall structure of the simplified DES shown in Figure 2.5. The S-DES
encryption algorithm takes an 8-bit block of plaintext (example: 10111101) and a 10-bit
key as input and produces an 8-bit block of ciphertext as output.
The S-DES decryption algorithm takes an 8-bit block of ciphertext and the same
10-bit key used to produce that ciphertext as input and produces the original 8-bit block of
plaintext.
Figure 2.5 Overview of S-DES Algorithm
The encryption algorithm involves five functions:
• An initial permutation (IP)
• A complex function labeled fk, which involves both permutation and
substitution operations and depends on a key input.
• A simple permutation function that switches (SW) the two halves of the
data.
• The function fk again.
A permutation function that is the inverse of the initial permutation
The function fk takes as input not only the data passing through the encryption
algorithm, but also an 8-bit key. Here a 10-bit key is used from which two 8-bit subkeys
are generated.
The key is first subjected to a permutation (P10). Then a shift operation is
performed. The output of the shift operation then passes through a permutation function
that produces an 8-bit output (P8) for the first subkey (K1).
The output of the shift operation also feeds into another shift and another instance
of P8 to produce the second subkey (K2).
The encryption algorithm can be expressed as a composition composition1 of
functions:
IP-1 ο fK2 ο SW ο fk1 ο IP, which can also be written as
Ciphertext = IP-1 (fK2 (SW (fk1 (IP (plaintext)))))
Where
K1 = P8 (Shift (P10 (Key)))
K2 = P8 (Shift (shift (P10 (Key))))
Decryption can be shown as Plaintext = IP-1 (fK1 (SW (fk2 (IP (ciphertext)))))
First, permute the key in the following fashion. Let the 10-bit key be designated as
(k1, K2, k3, k4, k5, k6, k7, k8, k9, k10). Then the permutation P10 is defined as:
P10 (k1, K2, k3, k4, k5, k6, k7, k8, k9, k10) = (k3, k5, K2, k7, k4, k10 10, k1, k9,
k8, k6).
P10 can be concisely defined by the display:
This table is read from left to right; each position in the table gives the identity of
the input bit that produces the output bit in that position. So, the first output bit is bit 3 of
the input; the second output bit is bit 5 of the input, and so on.
Example
The 10 bit key is (1010000010), now find the permutation from P10 for this key so
it becomes (10000 01100).
Next, perform a circular left shift (LS-1), or rotation, separately on the first five bits
and the second five bits. In our example, the result is (00001 11000).
Next, apply P8, which picks out and permutes 8 of the 10 bits according to the
following rule:
So, The result is subkey 1 (K1). In our example, this yield (10100100).
Then go back to the pair of 5-bit strings produced by the two LS-1 functions and
performs a circular left shift of 2 bit positions on each string. In our example, the value
(00001 11000) becomes (00100 00011).
The most complex component of S-DES is the function fk, which consists of a
combination of permutation and substitution functions. The functions can be expressed as
follows. Let L and R be the leftmost 4 bits and rightmost 4 bits of the 8-bit input to f K, and
let F be a mapping (not necessarily one to one) from 4-bit strings to 4-bit strings. Then we
let
Fk (L, R) = (L⊕F (R, SK), R)
Where SK is a sub key and ⊕is the bit-by- bit exclusive OR function
Now, describe the mapping F. The input is a 4-bit number (n1 n2 n3 n4). The first
operation is an expansion/permutation operation:
The S-boxes operate as follows. The first and fourth input bits are treated as a 2-
bit number that specify a row of the S-box, and the second and third input bits specify a
column of the S-box. Each s box gets 4-bit input and produce 2 bits as output. It follows
00- 0, 01-1, 10-2, 11-3 scheme.
Here, take first 4 bits, Second 4 bits
S0 => 1101 S1 => 1001
11 - > 3 11 -> 3
10 -> 2 => 3 =>11 00 -> 0 = > 2 => 10
So, we get 1110
➢ Now, find P4
1110 1100
.
4. Second function fk
➢ First, do E/P function and XOR with K2, the value is 01101001⊕01000011, the answer is
00101010
➢ Now, find S0 and S1
S0 => 00 - > 0 S1 = > 10 -> 2
01 -> 1 => 0 = 00 01 -> 1 = > 0 => 00
Value is 0000
➢ Now, find P4 and XOR operation
After P4 => 0000 ⊕ 1110 = 1110, then concatenate last 4 bits after interchange in sw.
➢ Now value is 11101100
5. Find IP-1
The most widely used encryption scheme is based on the Data Encryption Standard
(DES) adopted in 1977. The algorithm itself is referred to as the Data Encryption Algorithm
(DEA).
For DES, data are encrypted in 64-bit blocks using a 56-bit key. The algorithm
transforms 64-bit input in a series of steps into a 64-bit output.
Phase 2:
This is followed by a phase consisting of 16 rounds of the same function, which involves
both permutation and substitution functions.
The output of the last (sixteenth) round consists of 64 bits that are a function of the input
plaintext and the key. The left and right halves of the output are swapped to produce the
preoutput.
Phase 3:
Finally, the preoutput is passed through a permutation (IP-1) that is the inverse of the
initial permutation function, to produce the 64-bit ciphertext.
The right-hand portion of Figure shows the way in which the 56-bit key is used.
Operation on key:
Initially, the key is passed through a permutation function. Then, for each of the 16
rounds, a subkey (Ki) is produced by the combination of a left circular shift and a permutation.
The permutation function is the same for each round, but a different subkey is produced
because of the repeated shifts of the key bits.
Initial Permutation
The input to a table consists of 64 bits numbered from 1 to 64. The 64 entries in the
permutation table contain a permutation of the numbers from 1 to 64. Each entry in the
permutation table indicates the position of a numbered input bit in the output, which also
consists of 64 bits.
Permutation Tables for DES
M1 M2 M3 M4 M5 M6 M7 M8
M9 M10 M11 M12 M13 M14 M15 M16
M17 M18 M19 M20 M21 M22 M23 M24
M25 M26 M27 M28 M29 M30 M31 M32
M33 M34 M35 M36 M37 M38 M39 M40
M41 M42 M43 M44 M45 M46 M47 M48
M49 M50 M51 M52 M53 M54 M55 M56
M57 M58 M59 M60 M61 M62 M63 M64
where Mi is a binary digit. Then the permutation X = IP(M) is as follows:
M58 M50 M42 M34 M26 M18 M10 M2
M60 M52 M44 M36 M28 M20 M12 M4
M62 M54 M46 M38 M30 M22 M14 M6
M64 M56 M48 M40 M32 M24 M16 M8
M57 M49 M41 M33 M25 M17 M9 M1
M59 M51 M43 M35 M27 M19 M11 M3
M61 M53 M45 M37 M29 M21 M13 M5
M63 M55 M47 M39 M31 M23 M15 M7
Inverse permutation Y = IP-1 (X) = IP-1(IP(M)),Therefore we can see that the original ordering of
the bits is restored.
The below figure 2.9 shows the internal structure of a single round. The left and right halves of
each 64-bit intermediate value are treated as separate 32-bit quantities, labeled L (left) and R
(right). The overall processing at each round can be summarized in the following formulas:
Li= Ri-1
Ri= Li-1 x F(Ri-1, Ki)
Definition of S-Boxes
The substitution consists of a set of eight S-boxes, each of which accepts 6 bits as input
and produces 4 bits as output. The first and last bits of the input to box Si form a 2-bit binary
number to select one of four substitutions defined by the four rows in the table for Si. The middle
four bits select one of the sixteen columns as shown in figure 2.10.
The decimal value in the cell selected by the row and column is then converted to its 4-
bit representation to produce the output.
For example, in S1 for input 011001, the row is 01 (row 1) and the column is 1100
(column 12). The value in row 1, column 12 is 9, so the output is 1001.
As with any Feistel cipher, decryption uses the same algorithm as encryption, except that the
application of the subkeys is reversed. Additionally, the initial and final permutations are
reversed.
The strength of DES depends on two factors: key size and the nature of the algorithm.
3. Timing Attacks
A timing attack is one in which information about the key or the plaintext is obtained by
observing how long it takes a given implementation to perform decryptions on various
ciphertexts. A timing attack exploits the fact that an encryption or decryption algorithm often
takes slightly different amounts of time on different inputs.
Differential cryptanalysis is the first published attack that is capable of breaking DES in less
than 255 complexities. The need to strengthen DES against attacks using differential
cryptanalysis played a large part in the design of the S-boxes and the permutation P.
• One of the most significant recent (public) advances in cryptanalysis
• Powerful method to analyze block ciphers
• Used to analyze most current block ciphers with varying degrees of success
Differential Cryptanalysis Attack:
In differential cryptanalysis, we start with two messages, m and m', with a known XOR
difference Δm= m m', and consider the difference between the intermediate message halves:
mi= mi mi' Then we have:
Let us suppose that there are many pairs of inputs to f with the same difference yield the
same output difference if the same subkey is used.
Therefore, if we know Δmi-1 and Δmi with high probability, then we know Δmi+1 with high
probability. Furthermore, if a number of such differences are determined, it is feasible to
determine the subkey used in the function f.
This attack is based on the fact that linear equation can be framed to describe the
transformations.
The principle of linear crypt analysis is as follows
Length of CT and PT =n bits;
key=mbit
Block of cipher text is c[1]c[2]…c[n]; Block
of key is k[1]k[2]….k[m]
A[I,j,..k] = A[i] A[j] . A[k]
➢ Can attack DES with 247 known plaintexts, still in practice infeasible
➢ Find linear approximations with prob p != ½
➢ P[i1,i2,...,ia](+)c[j1,j2,...,jb] = k[k1,k2,...,kc]Where ia, jb, kc are bit locations in p, c, k
2.10 BLOCK CIPHER PRINCIPLES
There are three critical aspects of block cipher design:
1. Number of rounds,
2. Design of the function F
3. Key scheduling.
Number of Rounds
• When the greater the number of rounds, the more difficult it is to perform cryptanalysis,
even for a relatively weak F.
• The number of rounds is chosen so that known cryptanalytic efforts require greater effort
than a simple brute-force key search attack
• When round DES S= 16, a differential cryptanalysis attack is slightly less efficient than
brute force, the differential cryptanalysis attack requires 255 operations.
• It makes it easy to judge the strength of an algorithm and to compare different algorithms.
Design of Function F
• The key is used to generate one sub key for each round.
• The sub keys to maximize the difficulty of deducing individual sub keys and the difficulty
of working back to the main key.
A stream cipher is one that encrypts a digital data stream one bit or one byte at a time.
E.g, vigenere cipher. Figure (2.11a)
A block cipher is one in which a block of plaintext is treated as a whole and used to produce a
cipher text block of equal length. Typically, a block size of 64 or 128 bits is used. Figure (2.11b)
Figure 2.11 Stream Cipher and Block Cipher
➢ Many block ciphers have a Feistel structure. Such a structure consists of a number of
identical rounds of processing.
➢ In each round, a substitution is performed on one half of the data being processed,
followed by a permutation that interchanges the two halves.
➢ The original key is expanded so that a different key is used for each round.
➢ The Data Encryption Standard (DES) has been the most widely used encryption
algorithm. It exhibits the classic Feistel structure.
➢ The DES uses a 64-bit block and a 56-bit key. Two important methods of cryptanalysis
are differential cryptanalysis and linear cryptanalysis. DES has been shown to be highly
resistant to these two types of attack.
➢ A block cipher operates on a plaintext block of n bits to produce a ciphertext block of n
bits. There are possible different plaintext blocks and, for the encryption to be reversible
(i.e., for decryption to be possible), each must produce a unique ciphertext block. Such a
transformation is called reversible, or non singular
➢ In particular, Feistel proposed the use of a cipher that alternates substitutions and
permutations, where these terms are defined as follows:
• Substitution: Each plaintext element or group of elements is uniquely replaced by
a corresponding ciphertext element or group of elements.
The vulnerability of DES to a brute-force attack has been detected by using two approaches are
shown in figure 2.13
1. One approach is to design a completely new algorithm, of which AES is a prime example
2. Another alternative, which would preserve the existing investment in software and
equipment, is to use multiple encryptions with DES and multiple keys.
Double DES
The simplest form of multiple encryptions has two encryption stages and two keys. Given a
plaintext P and two encryption keys K1 and K2, cipher text C is generated as
Meet-in-the-Middle Attack
The use of double DES results in a mapping that is not equivalent to a single DES
encryption. But there is a way to attack this scheme, one that does not depend on any particular
property of DES but that will work against any block encryption cipher. This algorithm, known as
a meet-in-the-middle attack.
It is based on the observation that, if we have
Then
Given a known pair, (P, C), the attack proceeds as follows. First, encrypt P for all 256
possible values of K1. Store these results in a table and then sort the table by the Values of X.
Next, decrypt C using all 256 possible values of K2. As each decryption is
produced,
check the result against the table for a match.
If a match occurs, then test the two resulting keys against a new known plaintext–cipher
text pair. If the two keys produce the correct cipher text, accept them as the correct keys.
For any given plaintext P, there are 264 possible cipher text values that could be
produced by double DES. Double DES uses, in effect, a 112-bit key, so that there are 2112
possible keys.
The simplest mode is the electronic codebook (ECB) mode shown in figure 2.15. Here
plaintext is handled one block at a time and each block of plaintext is encrypted using the same
key.
The term codebook is used because, for a given key, there isa unique cipher text for every
b-bit block of plaintext.
When the message longer than b bits, to break the message into b-bit blocks. For the last
block when the no of bits is less than b, padding the last block if necessary.
Decryption is performed one block at a time, always using the same key.
Uses: The ECB method is ideal for a short amount of data, such as an encryption key.
Disadvantage:
When b‟ -bit block of plaintext appears more than once in the message, it always
produces the same cipher text output.
For lengthy messages, the ECB mode may not be secure. If the message is highly
structured, it may be possible for a cryptanalyst to exploit these regularities.
If the message has repetitive elements with a period of repetition a multiple of b bits, then
these elements can be identified by the analyst.
This may help in the analysis or may provide an opportunity for substituting or
rearranging blocks.
Figure 2.15 Electronic Code Book (ECB)
Mode Properties for Evaluating and Constructing ECB
Overhead: The additional operations for the encryption and decryption operation when
compared to encrypting and decrypting in the ECB mode.
Error recovery: The property that an error in the ith cipher text block is inherited by only a few
plaintext blocks
Error propagation: It is meant here is a bit error that occurs in the transmission of a cipher text
block, not a computational error in the encryption of a plaintext block.
Diffusion: Low entropy plaintext blocks should not be reflected in the cipher text blocks.
Roughly, low entropy equates to predictability or lack of randomness
Security: Whether or not the cipher text blocks leak information about the plaintext blocks.
This method is to overcome the disadvantage of ECB (i.e) when the PT block is
repeated CBC produces different cipher text blocks
The input to the encryption function for each plaintext block bears no fixed relationship to
the plaintext block. Therefore, repeating patterns of b bits are not exposed.
For decryption, each cipher block is passed through the decryption algorithm. The result
is XORed with the preceding cipher text block to produce the plaintext block are shown in figure
2.16.
Figure 2.16 Cipher Block Chaining (CBC) Mode
Then
To produce the first block of cipher text, an initialization vector (IV) is XORed with the first
block of plaintext.
On decryption, the IV is XORed with the output of the decryption algorithm to recover the
first block of plaintext.
For maximum security, the IV should be protected against unauthorized changes. This
could be done by sending the IV using ECB encryption
If an opponent is able to fool the receiver in to using a different value for IV, then the opponent is
able to invert selected bits in the first block of plaintext. To see this, consider
Now use the notation that X[i] denotes the ith bit of the b-bit quantity X. Then
Where the prime notation denotes bit complementation. This means that if an opponent
can predictably change bits in IV, the corresponding bits of the received value of P1 can be
changed.
2.11.4 MODE 3: Cipher Feedback Mode:
We know that the DES is a block cipher.it is possible to convert block cipher into stream Cipher
using CFB mode
Figure 2.17 depicts the CFB scheme. In the figure 2.17, it is assumed that the unit of
transmission is s bits; a common value is s = 8.
The units of plaintext are chained together; to get the cipher text is a function of all
preceding plaintext. Here the plaintext is divided into segments of s bits.
Encryption:
The input to the encryption function is a b-bit shift register that is initially set to some
initialization vector (IV).
The leftmost (most significant) s bits of the output of the encryption function are XORed
with the first segment of plaintext P1 to produce the first unit of cipher text C1.
The contents of the shift register are shifted left by s bits, and C1 is placed in the
rightmost (least significant) s bits of the shift register.
This process continues until all plaintext units have been encrypted.
Decryption:
The same scheme is used, except that the received cipher text unit is XORed with the
output of the encryption function to produce the plaintext unit.
In CFB, the output of the XOR unit is fed back to become input for encrypting the next
block.
The other difference is that the OFB mode operates on full blocks of plaintext and cipher
text, whereas CFB operates on an s-bit subset. OFB encryption can be expressed as
Where
Let the size of a block be b. If the last block of plaintext contains u bits (indicated by *), with
u<b, the most significant u bits of the last output block ON are used for the XOR operation
The remaining b - u bits of the last output block are discarded.
Figure 2.18 Output Feedback Mode
Advantage:
Bit errors in transmission do not propagate (i.e.) when bit errors occurs in Ci, Pi is alone
affected
Disadvantage:
The counter (CTR) mode has increased recently with applications to ATM
(asynchronous transfer mode) network security and IP sec (IP security).
A counter equal to the plaintext block size is used. The counter value must be different
for each plaintext block as shown in figure 2.19.
The counter is initialized to some value and then incremented by 1 for each subsequent
block (modulo 2b, where b is the block size). For encryption, the counter is encrypted and then
XORed with the plaintext block to produce the cipher text block.
For decryption, the same sequence of counter values is used, with each
encrypted counter XORed with a cipher text block to recover the corresponding plaintext block.
Advantage:
Hardware efficiency
• CTR can be done in parallel
Software efficiency
• CTR supports parallel feature pipelining
Preprocessing
Simplicity
AES is a symmetric block cipher that is intended to replace DES as the approved
standard for a wide range of applications. Compared to public-key ciphers such as RSA, the
structure of AES and most symmetric ciphers is quite complex and cannot be explained as
easily as many other cryptographic, algorithms.
In AES, all operations are performed on 8-bit bytes. The arithmetic operations of
addition, multiplication, and division are performed over the finite field GF.A field is a set in
which we can do addition, subtraction, multiplication, and division without leaving the set.
Division is defined with the following rule: a/b = a(b-1).
An example of a finite field (one with a finite number of elements) is the set Zp consisting of
all the integers {0, 1, c, p - 1}, where p is a prime number and in which arithmetic is carried out
modulo p.
The way of defining a finite field containing 2nelements; such a field is referred to as GF(2n).
Consider the set, S, of all polynomials of degree n - 1 or less with binary coefficients. Thus,
each polynomial has the form
Where each ai takes on the value 0 or 1. There are a total of 2ndifferent polynomials in S.
For n = 3, the 23 = 8 polynomials in the set are
6. Each stage is easily reversible. For the Substitute Byte, ShiftRows, and MixColumns
stages, an inverse function is used in the decryption algorithm. For the AddRoundKey
stage, the inverse is achieved by XORing the same round key to the block, using
the result that.
7. The decryption algorithm makes use of the expanded key in reverse order. However, the
decryption algorithm is not identical to the encryption algorithm. This is a consequence
of the particular structure of AES.
Fig 2.23 AES Encryption Round
8. Once it is established that all four stages are reversible, it is easy to verify that
decryption does recover the plaintext.
9. The final round of both encryption and decryption consists of only three stages. Again,
this is a consequence of the particular structure of AES and is required, to make the cipher
reversible
Four transformations used in AES. For each stage, we describe the forward (encryption)
algorithm, the inverse (decryption) algorithm, and the rationale for the stage.
The forward substitute byte transformation, called Sub Bytes, is a simple table
lookup (Figure 2.24a). AES defines a 16 * 16 matrix of byte values, called an S-box that
contains a permutation of all possible 256 8-bit values.
Each individual byte of State is mapped into a new byte in the following way: The
leftmost 4 bits of the byte are used as a row value and the rightmost 4 bits are used as a column
value. These row and column values serve as indexes into the S-box to select a unique8-bit
output value as shown in figure 2.25.
For example, the hexadecimal value {95} references row 9, column 5 of the S-box, which
contains the value {2A}. Accordingly, the value {95} is mapped into the value {2A}.
1. Initialize the S-box with the byte values in ascending sequence row by row. The first row
contains {00}, {01}, {02}, c, {0F}; the second row contains {10}, {11}, etc.; and so on. Thus, the
value of the byte at row y, column x is {yx}.
2. Map each byte in the S-box to its multiplicative inverse in the finite field GF(28); the value
{00} is mapped to itself.
3. Consider that each byte in the S-box consists of 8 bits labeled (b7, b6, b5, b4, b3,b2, b1, b0).
Apply the following transformation to each bit of each byte in the S-box:
Where ci is the ith bit of byte c with the value {63}; that is, (c7c6c5c4c3c2c1c0) = (01100011). The
prime ( „) indicates that the variable is to be updated by the value on the right.
Figure 2.26 Construction of S-Box and IS-Box
• In ordinary matrix multiplication, each element in the product matrix is the sum of
products of the elements of one row and one column. Each element in the product
matrix is the bitwise XOR of products of elements of one row and one column.
• As an example, consider the input value {95}. The multiplicative inverse in GF(28) is
{95}- 1 = {8A}, which is 10001010 in binary. Using above Equation
The result is {2A}, which should appear in row {09} column {05} of the S-box.
The inverse substitute byte transformation, called InvSubBytes, For example, that the
input {2A}produces the output {95}, and the input {95} to the S-box produces {2A}. The inverse
S-box is constructed by applying the inverse of the transformation is followed by taking the
InvSubBytes is the inverse of Sub Bytes, label the matrices in sub Bytes and
InvSubBytes as X and Y, respectively, and the vector versions of constants c and d as C and D,
respectively. For some 8-bit vector B, becomes . We need to show that
. To multiply out, we must show . This becomes
We have demonstrated that YX equals the identity matrix, and the YC = D,so that YC D
equals the null vector.
The forward shift row transformation, called Shift Rows, is depicted in Figure 2.27.
The first row of State is not altered. For the second row, a 1-byte circular left shift is performed.
For the third row, a 2-bytecircular left shift is performed. For the fourth row, a 3-byte circular left
shift is performed. The following is an example of Shift Rows
The inverse shift row transformation, called InvShiftRows, performs the circular shifts
in the opposite direction for each of the last three rows, with a 1-byte circular right shift for the
second row, and as shown in figure 2.28
Each element in the product matrix is the sum of products of elements of one rowand
one column. In this case, the individual additions and multiplications are performed in GF(28).
For the first equation, we have {02}.{87} =(0000 1110) (0001 1011) =(0001 0101) and
{03}. {6E} = {6E} ({02}. {6E}) = (0110 1110) (1101 1100) = (1011 0010) then
The inverse mix column transformation, called InvMixColumns, is defined by
the following matrix multiplication:
That is, the inverse transformation matrix times the forward transformation matrix
equals the identity matrix. To verify the first column of above Equation.
For the first equation, we have {0E}.{02} =00011100 and {09}.{03} ={09} {09}.{02} =
00001001 00010010 =00011011then
The encryption was deemed more important than decryption for two reasons:
1. For the CFB and OFB cipher modes only encryption is used.
2. AES can be used to construct a message authentication code and for this, only encryption is
used.
In the forward add round key transformation, called AddRoundKey, the 128 bits of State are
bitwise XORed with the 128bits of the round key.
The operation is viewed as a column wise operation between the 4 bytes of a State column and
one word of the roundkey; it can also be viewed as a byte-level operation.
The following is an example ofAddRoundKey:
The first matrix is State, and the second matrix is the round key.
The inverse add round key transformation is identical to the forward addround key
transformation, because the XOR operation is its own inverse.
The Figure 2.29 is another view of a single round of AES, emphasizing the mechanisms and
inputs of each transformation.
1. RotWord performs a one-byte circular left shift on a word. This means that a input word [B0,
B1, B2, B3] is transformed into [B1, B2, B3, B0].
2. SubWord performs a byte substitution on each byte of its input word, using the S-box.
3. The result of steps 1 and 2 is XORed with a round constant, Rcon[j].
The round constant is a word in which the three rightmost bytes are always 0.Thus, the
effect of an XOR of a word with Rcon is to only perform an XOR on the leftmost byte of the
word. The round constant is different for each round and is defined as Rcon[j] = (RC[j], 0, 0, 0),
with RC[1] = 1, RC[j] = 2 # RC[j-1] and with multiplication defined over the field GF(28). The
values of RC[j] in hexadecimal are
Results
Table 2.4 shows the expansion of the 16-byte key into 10 round keys. The process is formed
word by word, with each four-byte word occupying one column of the word round-key matrix.
The left-hand column shows the four round-key words generated for each round. The
right-hand column shows the steps used to generate the auxiliary word used in key expansion.
The key itself serving as the round key for round 0.
Next, Table 2.5 shows the progression of State through the AES encryption process.
The first column shows the value of State at the start of a round. For the first row, State is just
the matrix arrangement of the plaintext. The second, third, and fourth columns show the value of
State for that round after the SubBytes, ShiftRows,andMixColumns transformations,
respectively. The fifth column shows the roundkey.
Table 2.5 progression of State through the AES encryption process
// Initialization
for
i = 0 to 255 do S[i] = i;
T[i] = K[i mod klen];
Next, use T to produce the initial permutation of S. Starting with S[0] to S[255], and for
each S[i] algorithm swap it with another byte in S according to a scheme dictated by T[i], but S
will still contain values from 0 to 255:
// Initial Permutation of S
j = 0;
for i = 0 to 255
do
{
j = (j + S[i] + T[i]) mod 256;
Swap(S[i], S[j]);
}
2. A third party can select the key and physically deliver it to A and B.
3. If A and B have previously and recently used a key, one party can transmit the
new key to the other, encrypted using the old key.
4. If A and B each has an encrypted connection to a third-party C, C can deliver a
key on the encrypted links to A and B.
➢ Physical delivery (1 & 2) is simplest - but only applicable when there is personal contact
between recipient and key issuer. This is fine for link encryption where devices & keys
occur in pairs, but does not scale as number of parties who wish to communicate grows.
3 are mostly based on 1 or 2 occurring first.
➢ A third party, whom all parties trust, can be used as a trusted intermediary to mediate the
establishment of secure communications between them (4). Must trust intermediary not to
abuse the knowledge of all session keys. As numbers of parties grow, some variant of 4
is only practical solution to the huge growth in number of keys potentially needed.
2.14.2 Key Distribution Centre
➢ The use of a key distribution centre is based on the use of a hierarchy of keys. At a
minimum, two levels of keys are used.
➢ Communication between end systems is encrypted using a temporary key, often referred
to as a Session key.
➢ Typically, the session key is used for the duration of a logical connection and then
discarded
➢ Master key is shared by the key distribution centre and an end system or user and used
to encrypt the session key.
2.14.3 Key Distribution Scenario
➢ Let us assume that user A wishes to establish a logical connection with B and requires a
one-time session key to protect the data transmitted over the connection. A has a
master key, Ka, known only to itself and the KDC; similarly, B shares the master key Kb
with the KDC (Figure 2.36). The following steps occur:
Figure 2.36 Key Distribution Scenarios
1. An issue a request to the KDC for a session key to protect a logical connection to B. The
message includes the identity of A and B and a unique identifier, N1, for this transaction,
which we refer to as a nonce. The nonce may be a timestamp, a counter, or a random
number; the minimum requirement is that it differs with each request. Also, to prevent
masquerade, it should be difficult for an opponent to guess the nonce. Thus, a random
number is a good choice for a nonce.
2. The KDC responds with a message encrypted using Ka Thus, A is the only one who can
successfully read the message, and A knows that it originated at the KDC. The message
includes two items intended for A:
• The one-time session key, Ks, to be used for the session
• The original request message, including the nonce, to enable A to match this
response with the appropriate request
Thus, A can verify that its original request was not altered before reception by the KDC
and, because of the nonce, that this is not a replay of some previous request. In
addition, the message includes two items intended for B:
• The one-time session key, Ks to be used for the session